Commit Graph
164 Commits
Author SHA1 Message Date
Ofek 4e5348ab77 Tsify tools (mostly) (#7018)
This includes among others:
 - Proper tsification of various tools code,
 - Elimination of the `CompilationInfo2` type,
 - Use of `CompilationInfo` instead of `Record<any, any>` in some places
 - These lines in CompilationResult:
```
    // Temp hack until we get all code to agree on type of asm
    asm?: ResultLine[] | string;
```

The next task would be to get all code to agree on the type of
CompilationResult.asm, thereby enabling fixing of most the remaining
TSification.
2024-10-26 10:58:30 +03:00
Ofek 2df8d32758 Tsify #6 (#6941)
Another tsification batch. 347 to go and I'm running out of easy fixes
:(
2024-10-22 21:41:44 +03:00
Ofek f715dc2932 More tsification (#6877)
About half way through. Only 708 tsification errors to go..
2024-09-28 10:32:36 +03:00
Ofek fecd0fbf11 tsification + small package upgrade (semver) (#6841) 2024-09-10 17:18:48 +03:00
Ofek 9ef46fbafe Binge of (mostly) mindless tsification (#6838)
Turned on `noImplicitAny` in tsconfig, then went around fixing some
random easy stuff.
Hopefully tsification-PRs with more real content coming up.
2024-09-07 14:36:43 +03:00
Detjon Mataj 53c04b26af Add bloaty tool for C, C++, D, Rust and Pascal (#6790)
Added `bloaty` tool configuration for C, C++, D, Rust and Pascal. 

resolve #6240
2024-08-24 15:01:26 -05:00
Ofek 1234363d8e Fix in clang-format arg handling (#6782)
Fix #6765: don't let an empty `stdin` override explicit args
2024-08-22 13:34:41 +03:00
Peter Waller 38b2d9a16e Improve passthrough of -march and -mcpu from compiler to llvm-mca (#6710)
This patch fixes a few issues with argument passthrough that have been
discovered since #6682 was landed.

* X86 didn't work if -march=CPU was supplied.
* It wasn't possible to override flags on MCA, because the auto-detected
  flags came before user flags.
* Since compiler-explorer runs on x86 native hardware, if targetting
  aarch64, it would result in an error about the default requested
  native CPU not being available for the architecture.

X86 clang uses -march to specify the CPU, and it's invalid to supply
-march=<cpu> to LLVM-MCA. Meanwhile, LLVM-MCA requires an -mcpu
argument.

Therefore, to handle x86 it's necessary to rewrite -march to -mcpu so
long as the march flag is used to supply a CPU value (i.e. not an
architecture level beginning with `x86-64`).

Per https://maskray.me/blog/2022-08-28-march-mcpu-mtune, I understand
x86 is currently the only target to have this behaviour so it needs
special casing.

Additionally, llvm-mca assumes -mcpu=native if it is not otherwise
specified. Since compiler-explorer runs on x86 hardware, it is easy to
end up in a situation for example targetting aarch64 but with -mcpu=<an
x86 CPU>. To handle this case some logic is added to detect if a CPU is
not specified and the target is not x86, in which case -mcpu=generic is
supplied instead as a reasonable default for the target.

Further, handle the case where --target is being passed to the compiler,
and pass this through as -mtriple.

Testing:

* I have been testing on an aarch64-native machine.
* I have tested targeting x86 by specifying --target and using the
  override functionality in compiler explorrer to specify x86.
* I have been inspecting the `--debug` output to see what flags are
  passed to LLVM-MCA.
* I've checked that I can override the -mcpu in MCA regardless of what
  is passed to the compiler.
* I have checked that I can supply either -march=x86-64* or -march=<cpu>
  on the x86 target and things behave as expected.

Fixes: #6709
2024-07-31 20:16:50 -05:00
Peter Waller 928f3b2ab0 Pass instructionSet, -mcpu, -march and -mtriple through to llvm-mca (#6682)
Currently if an MCA instance is constructed on a compiler, MCA runs with
the default target for the host it is running on.

Make it respect the target architecture by passing an -mtarget to MCA
conditioned on the detected instructionSet of the compiler.

Additionally, pass through any -mcpu, -march or -mtriple specified to
the compiler.
2024-07-10 06:53:45 -05:00
Patrick Quist b8325cf0c6 eslint root setting and fixes (#6307) 2024-04-16 21:26:53 +02:00
Ofek 5bcc3bf74f Refuse to run llvm-mca with "Compile to binary object" (#6276)
Fixes #5735
2024-03-23 23:00:30 +02:00
Patrick Quist 2f0ff5aeb1 fix llvm-cov (#6211) 2024-03-02 14:08:39 +01:00
Ofek 21fe5523c0 Since ES6 there's no reason to use underscores map and filter (#5989)
Mindless replacements of the form 
`_.filter(options, option =>...`  --> `options.filter(option =>...`.

One not *entirely* mindless replacement at the bottom of
compiler-dropin-tool.ts :
```
-        return _.filter(pathFilteredFlags) as string[];
+        return pathFilteredFlags.filter(Boolean) as string[];
```
6 files can now stop importing underscore.
2024-01-13 18:35:11 +02:00
David Spickett e15619abfe Add llvm-dwarfdump tool for C/C++ languages (#5726)
https://llvm.org/docs/CommandGuide/llvm-dwarfdump.html

This dumps the DWARF debugging information in a human readable form:
```
<source>: file format ELF64-x86-64

.debug_info contents:
0x00000000: Compile Unit: length = 0x00000063 version = 0x0004 abbr_offset = ... 

0x0000000b: DW_TAG_compile_unit
              DW_AT_producer  ("GNU C17 9.4.0 ...)
```

This tool would be useful to have when comparing the debug output of two
compiler versions or compiler targets. For instance I wanted to find out
recently how AArch64 and X86 targets represent TLS variables.

The tool runs on the compiled binary, so is post compilation. If the
binary
has no debug information the tool does not crash, it just tells you that
there is no information.

To fit the other llvm/clang tools, I've just added an "llvm-dwarfdump
(trunk)"
like llvm-mca has done. Added it to c/c++/objc/objc++ (open CL can't
compile
to binary so skipped those). MSVC is excluded because it produces PDB
files
instead.

The tool works for at least ELF and XCOFF files, I haven't been able to
test
any others.
2023-11-12 14:21:52 -06:00
Jeremy Rifkin 3eaa274904 Add nm (#5058)
Changes on top of #5057
2023-05-17 15:24:01 -04:00
Jeremy Rifkin 33c05780c9 Clarify a readelf / pahole error message and add readelf to defaults.properties (#5057) 2023-05-17 15:01:00 -04:00
Fred Tingaud 9ceb1dc6eb Increase size limit for sonar output (#5031) 2023-05-09 19:18:35 +02:00
Jeremy Rifkin d72d2d8c0f Fix clang stdin bug (#4986) 2023-04-23 11:30:50 +02:00
Fred Tingaud 6d27eaac0e Sonar analysis: fix library usage (#4974) 2023-04-19 22:09:57 +02:00
Fred Tingaud 6e0aa5f630 Fix Sonar rule URLs for C (#4949)
Forgot there were some hard-coded parts about the language in the
URLs...
2023-04-10 08:14:16 -05:00
Fred Tingaud 477ba96c05 Ft/branch (#4946)
Small fixes for the Sonar analyzer.
* Support the C language
* Fix the argument passing. This one is not really relevant for users but useful for us if we need to debug a crash someday.
2023-04-05 11:09:39 -05:00
Matt Godbolt 3461db6c19 Bump all minor versions - npm update; also bump webpack version speculatively... (#4851)
also npm lint and format to make sure any changes turn up.
2023-03-12 11:29:57 -05:00
Fred Tingaud 3b3035e57b Add a tool with Sonar C++ analysis. (#4837)
This is a preview of the static analysis capabilities of the Sonar C++ analyzer. See https://www.sonarsource.com/ for more information.
2023-03-09 21:23:07 -06:00
Rubén Rincón Blanco dd2c08693c Add name to binary tools error response (#4798) 2023-03-06 20:10:00 +01:00
Mats Jun LarsenandMatt Godbolt 633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin 384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Jeremy Rifkin 2b06c69111 Turn some auto-fixable eslint rules back on (#4766)
This PR turns comma-dangle and indent eslint rules on for lib/. These
are rules inherited from the eslint config for static/, this PR just
makes things more consistent. Also turned
@typescript-eslint/no-var-requires back on while I was here.
2023-02-23 17:16:17 -05:00
Jeremy Rifkin 0d5e3ac775 Tsify the rest of lib/tooling (#4718)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2023-02-12 11:57:12 -05:00
Scott Tran b31ee6a643 Tsify clang-tidy-tool (#4695) 2023-02-05 18:48:20 -05:00
Scott Tran d10b24a708 tsify clang-query-tool (#4696) 2023-02-05 15:28:29 +01:00
Scott Tran 9591f14409 tsify clang-format-tool (#4697) 2023-02-05 15:28:22 +01:00
Scott Tran e3da6f7f49 remove bbcdiskify-tool.js (#4693) 2023-02-05 15:28:10 +01:00
Jeremy Rifkin 6207cb2d6e npm run lint to get const fixes 2023-01-17 12:31:49 -05:00
Marc Poulhiès 6d0d81d2c6 fix: pahole wrongly refuses to do anything (#4581)
Condition was badly changed in #3232 (compiling to binary objects)
2023-01-12 15:37:07 +01:00
Marc Poulhiès 69055681d9 Support for compiling to binary object (#3232) 2023-01-11 19:39:25 +01:00
Partouf fd09bacf6b formatting 2023-01-06 17:11:35 +01:00
Marc Poulhiès 8503ed60fa fix: empty exclude value in option file badly handled (#4546) 2023-01-06 16:57:43 +01:00
Matt Godbolt 749319f791 Slightly more controversial bumpings (#4503)
- latest sentry, tar-stream, which, some yamljs versions
- latest eslint-* stuff
- latest webpack manifest
- Applies all the automatic fixes for newer lint rules
- Bump the webpack version

applies new tslint stuff
2022-12-28 11:42:14 -06:00
Matt Godbolt d94eb203c1 Add lint rule for unused imports, and fix (#4476) 2022-12-20 15:51:39 -06:00
Matt Godbolt 57a647b8a3 Add the result inside the CompilationResult (#4475) 2022-12-20 08:15:39 -06:00
Matt Godbolt 6348917e15 Separate shareable tool type from server ITool (#4472)
* Separate shareable tool type from server ITool

I realised we were using the "Tool" on both client and server, but the client only has the JSON-able data of Tool, not the interface/object Tool (now renamed to `ITool`).

* Fix tests
2022-12-19 22:40:27 -06:00
Patrick Quist 9de0b70af3 min effort ts conv dropintool (#4412) 2022-12-12 20:11:05 -06:00
Matt Godbolt c5f50d603c Fix typing and usage of tools (#4180)
* Fix typing and usage of tools
* Fix tests and break cycle
* More improvements
2022-10-22 17:16:23 -05:00
Rubén Rincón Blanco 2394c94c6e Try to fix the ld issue by using compiler options (#4071) 2022-09-21 16:24:22 +02:00
RabsRincon 2556bc5bb3 Fix eslint warning 2022-09-15 08:13:45 +02:00
Rubén Rincón Blanco 366cd5527c Adds llvm-cov tool (#4044) 2022-09-15 08:12:27 +02:00
Matt Godbolt 7ac1d67348 Changes to prometheus counters (#3883) 2022-07-18 13:11:09 -05:00
Fred Tingaud 66b517b60a Get statistics on tools usage per language / compiler (#3851) 2022-07-07 18:28:54 +01:00
Fred Tingaud e76115f152 Make tools output parsing overridable. (#3819) 2022-07-01 00:30:49 +02:00
walkerhuangandWalker Huang 3bc192287d fix bug when creating error response (#3807)
Co-authored-by: Walker Huang <walker.huang@arm.com>
2022-06-24 20:57:10 +02:00