817 Commits

Author SHA1 Message Date
Patrick Quist
ee3e261bb3 Make libs= property optional via auto-discovery (#8552) 2026-03-11 21:40:54 +01:00
Patrick Quist
305156c0a4 fix: allow plus signs in property key names and values (#8485)
## Summary
- Fixes the property parser regex to allow `+` in key names (e.g.
`abc+def=etc`)
- The regex from #8387 used `[^=+]+` for key matching, which excluded
`+` from key names entirely
- Changed to a lazy `.+?` match so `+` is only treated as the `+=`
operator when immediately before `=`

This is a small targeted fix and does not address all edge cases with
the `+=` syntax.

## Test plan
- [x] Added test: `abc+def=etc` correctly sets key `abc+def` to `etc`
- [x] Added test: `abc=def+ghi` correctly sets key `abc` to `def+ghi`
- [x] All existing `+=` append tests continue to pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 21:10:47 -05:00
Jonathan Coates
e21749ea2b Update labelReference regex to match LLVM IR syntax (#8491)
A `catchswitch` instruction has the form:

    catchswitch within none [label %catch.start] unwind to caller

The LLVM IR parser then extracts the labels out of this expression.
However, the regex is too greedy, and (incorrectly) matches
`%catch.start]`. We update the regex to match what LLVM's lexer does.
The [language reference](https://llvm.org/docs/LangRef.html#identifiers)
states that quoted identifiers can include `\xx` escapes, however as far
as I can tell [that is *not*
true](413cafa462/llvm/lib/AsmParser/LLLexer.cpp (L391-L421)),
so I have elected not to support them.

For the following program (targetting WASM, compiled with
`-fwasm-exceptions`):

```c
void bar(int x);

void foo() {
    try {
        bar(1);
    } catch(int x) {
    }
}
```

**Before:**

<img width="1492" height="411" alt="A CFG of the above program. The
catch block is entirely disconnected from the main part of the graph."
src="https://github.com/user-attachments/assets/ad9038cc-f372-4109-bc25-328537bcea88"
/>

**After:**

<img width="1286" height="639" alt="A CFG of the above program. The
catch block is now correctly connected to the rest of the graph."
src="https://github.com/user-attachments/assets/27cce7b3-dd67-4c1c-928c-93f7eaa53fa2"
/>
2026-02-27 20:59:37 -05:00
Blake Ledden
05f60761ad Remove unused AsmResultLink type and links field (#8365)
The `links` field in `ParsedAsmResultLine` and the `AsmResultLink` type
have been unused since 2019 when clickable address links were replaced
by the labels system. This just removes the dead code.

Closes #8251
2026-02-27 20:49:32 -05:00
Matt Godbolt (bot acct)
20505fba5a Filter NVCC fatbinData label from assembly output (#8506)
*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)*

Closes #5178

## Problem

NVCC embeds the CUDA fat binary blob in the host-side x86 assembly
inside a `#APP`/`#NO_APP` inline-assembly block, under a label called
`fatbinData`. In a realistic kernel this can be 100+ lines of `.quad`
hex values — a wall of noise before any user-readable code.

Example: https://godbolt.org/z/W3YMcq8oY

## Fix

Per-compiler pre-processing step in `NvccCompiler.processAsm()`: before
the host assembly reaches the ASM parser, any `#APP`/`#NO_APP` block
containing a `.nv_fatbin` section is stripped out entirely.

- Only `.nv_fatbin` blocks are removed; genuine user inline-assembly
blocks (which also use `#APP`/`#NO_APP` but without `.nv_fatbin`) are
left intact.
- Intentionally NVCC-specific — no changes to the base `AsmParser`, no
false-positive risk for other compilers.
- Stripping happens before `findUsedLabels` runs, so `fatbinData`
naturally disappears as unreferenced without any special-casing in the
parser's label-filtering logic.
- Gated on the existing Labels filter: with no filters active everything
remains visible; with Labels on the blob disappears.

## Testing

**New compiler unit tests** (`test/compilers/nvcc-tests.ts`):
- Strips `#APP`/`#NO_APP` blocks containing `.nv_fatbin`
- Preserves `#APP`/`#NO_APP` blocks without `.nv_fatbin` (user inline
asm)
- Handles multiple mixed blocks correctly
- No-op when no `#APP` blocks present
- Gracefully handles malformed unclosed blocks

**New parser filter-case**
(`test/filters-cases/nvcc-x86-host-example.asm`): representative NVCC
12.0 host assembly (real 15-line fat binary, boilerplate functions,
`.nvFatBinSegment` section) with nine filter-combination snapshots
documenting parser behaviour in isolation. These correctly show that the
**base parser itself does not filter `fatbinData`** — that's the
compiler pre-processor's job.

All 767 tests pass.

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-02-22 19:46:36 -06:00
Matt Godbolt (bot acct)
54572dfa4d Add LLVM IR filters for declarations and library function thunks (#8503)
Closes #6319
Closes #6320

Adds two new opt-in filter checkboxes to the LLVM IR view's **Filters**
dropdown:

### Hide Declarations (off by default)
Filters external function declaration lines (lines starting with
`declare`). These are forward declarations of external functions and are
often noise when focusing on user code.

**Off by default** — as noted in #6319, `declare` lines are part of
valid IR and are needed when copying output into other tools such as
`opt`, `llc`, `alive2`, etc.

### Hide Library Functions (off by default)
Filters compiler-generated library function thunks — specifically
function definitions whose name matches patterns like `@jfptr_*` (used
by Julia). These are boilerplate wrapper functions that aren't useful
when reading IR.

**Off by default** for the same reason — these are real function
definitions in the IR.

Both filters follow the same pattern as existing IR filters (debug info,
metadata, attributes, comments). Unit tests added in
`llvm-ir-parser-tests.ts` covering filter-on, filter-off, and
preservation of unaffected lines.

*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)*

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-02-22 17:25:36 -06:00
Matt Godbolt
624c5c026e Update npm dependencies and fix tom-select type import (#8477)
Inline the escape_html type instead of importing from tom-select's
internal dist/types/ path, which was removed in v2.5.1. The type is just
(str: string) => string, so there's no need to depend on the package's
internal file layout.

Also fix missing iframe title attributes in test/embedding.html.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:12:07 -06:00
Erik Hemming
97233932f1 Add m68k asm parser to handle | comment character (#8469)
m68k GAS uses `|` as the comment character instead of `#`.
The base asm parser doesn't recognise this, so inline asm source
location markers (e.g. `| 2 "file.c" 1`) leak through into the output
instead of being filtered.

Repro on godbolt.org: https://godbolt.org/z/vYneWc8Tf

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2026-02-16 14:01:37 -06:00
narpfel
c4c0ad4c8b [llvm-ir]: Filter empty metadata nodes (#8473)
LLVM IR specialised metadata nodes can have no arguments, e. g.
[`DIAssignID`](https://llvm.org/docs/LangRef.html#diassignid), which is
commonly emitted by `clang` (https://godbolt.org/z/rb19oGMoT).

These were not filtered because the regex required at least one
character in the field list.
2026-02-16 10:38:21 -06:00
Christopher Erleigh
08ba65abd7 fix: use llvm-objdump for cross-architecture binary disassembly (#8460)
## Summary

- When multiarch compilers (Rust, Zig, etc.) target a non-host
architecture (e.g. `--target=aarch64-unknown-linux-gnu`), GNU `objdump`
fails because it cannot disassemble foreign-arch binaries, producing
`<No output: objdump returned 1>`
- Adds a `llvmObjdumper` config property that switches to `llvm-objdump`
when the compilation targets a non-x86 instruction set, since
`llvm-objdump` can auto-detect the target architecture from the binary
itself
- All multiarch compilers benefit from this generically via
`BaseCompiler.getObjdumperForResult()` — no per-compiler special-casing
needed

## Changes

- **`types/compiler.interfaces.ts`** — Add `llvmObjdumper` to
`CompilerInfo`
- **`lib/compiler-finder.ts`** — Read `llvmObjdumper` from config
- **`lib/base-compiler.ts`** — Add `getObjdumperForResult()` method and
refactor `objdump()` to use it
- **`etc/config/rust.defaults.properties`** — Set
`llvmObjdumper=llvm-objdump`
- **`etc/config/zig.defaults.properties`** — Set
`llvmObjdumper=llvm-objdump`
- **`test/objdumper-tests.ts`** — Add 6 tests for cross-architecture
objdumper selection

## Test plan

- [x] `npm run ts-check` passes
- [x] `npm run lint` passes
- [x] All related tests pass (301 tests across 27 files)
- [x] Smoke test: configure a Rust compiler with
`--target=aarch64-unknown-linux-gnu` and verify `llvm-objdump` is used
instead of GNU `objdump`

Fixes #5593
2026-02-16 10:35:07 -06:00
Matt Godbolt (bot acct)
4229733210 feat(asm): add ca65 assembler (cc65 toolchain) for 6502 (#8455)
Add ca65 as a standalone assembler under the Assembly language, reusing
the existing cc65 toolchain installations (2.17, 2.18, 2.19, trunk).

ca65 generates a listing file with full macro expansion (`-x -x`) so
users can debug macro output — the primary use case from the feature
request.

**What's included:**
- `Ca65Compiler` class — runs ca65, captures the listing output
- `AsmParserCa65` — parses the ca65 listing format (address, hex bytes,
source)
- Config for all 4 existing cc65 versions as ca65 assemblers
- Include paths set to each version's `asminc` directory

**How it works:**
Since ca65 produces object files in cc65's custom format (not ELF), we
can't objdump them. Instead, we use ca65's `-l` (listing) flag with `-x
-x` (full macro expansion) and `--list-bytes 0` (unlimited hex bytes per
line). The listing shows addresses, generated bytes, and expanded source
— exactly what users need for macro debugging.

Closes #7118

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-02-08 14:23:56 -06:00
Partouf
35b0a663cf hotfix go 2026-02-08 12:50:20 +01:00
Patrick Quist
eecaef4ef3 Add library support for Go compiler (#8397) 2026-02-08 01:18:43 +01:00
Matt Godbolt
2416973a8e Clean up and refactor LlvmPassDumpParser (#8430)
Addresses #4128 — cleans up commented-out code and improves code quality
in `LlvmPassDumpParser`.

**Commit 1: Remove commented-out code**
Remove unused fields (`label`, `instruction`), dead `maxIrLines`
configuration code, stale debug logging (`console.log`/`console.dir`),
and obsolete early-exit logic. The `compilerProps` constructor parameter
was only used by the commented-out code, so remove it and update all
call sites.

**Commits 2–4: Add comprehensive test suite**
50 tests locking in existing behaviour across all parser methods:
`breakdownOutputIntoPassDumps`, `breakdownPassDumpsIntoFunctions`,
`breakdownIntoPassDumpsByFunction`, `matchPassDumps`,
`associateFullDumpsWithFunctions`, and end-to-end `process()`. Covers
edge cases like loop dumps, `(invalidated)` passes, IR→MIR transitions,
CIR headers, and full-module mode.

**Commits 5–6: Clean up code style**
- snake_case → camelCase throughout (`raw_passes`, `final_output`,
`function_name`, etc.)
- Mark all regex fields `readonly`
- Replace `.map()` used for side effects with `for...of` loop
- Replace `[_, entry]` destructuring with `Object.values()`

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-02 20:06:09 -06:00
Artem Belevich
76dc4b0ca5 Add += append syntax for string properties. (#8387)
Introduce a += operator in property file parsing that appends values to
existing string properties. This allows splitting long property values
across multiple lines for improved readability.

Example:
  group.compilers=comp1:comp2:comp3
  group.compilers+=:comp4:comp5:comp6

Error handling:
- Logs error and skips if += is used on an undefined property
- Logs error and skips if += is used on a non-string property

Includes unit tests for the new functionality.

<!-- 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!
-->
2026-02-02 20:02:38 -06:00
Matt Godbolt
53c7dd328b Configure Biome import organiser with grouped imports (#8431)
Enable Biome's `organizeImports` with groups matching the original
ESLint `import/order` configuration:

1. **Node builtins** (`node:fs`, `path`, etc.)
2. *(blank line)*
3. **Third-party packages** (`express`, `@sentry/node`, etc.)
4. *(blank line)*
5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases)

This resolves the inconsistency where Biome wasn't enforcing import
grouping, meaning new files would lose the blank-line separation that
the old ESLint config enforced.

### Impact
- **354 files** updated out of 738 checked (~48%)
- **+188 / -240 lines** (net -52) — almost entirely single blank line
additions/removals between import groups
- No import reordering; purely group separator consistency

Fixes #7373

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-01 20:50:46 -06:00
Matt Godbolt
11cc294698 Fix debug info leaking through filters with clang 21 (#8425)
## Summary
- Fixes #8364: clang 21 debug info (`.debug_loclists` etc.) was passing
through directive+label filters
- The label processor's `endBlock` regex only matched `.cfi_endproc`,
missing section boundaries (`.section`, `.data`, `.text`) that the main
parser already handles — so `currentLabelSet` was never cleared across
sections, causing weak label associations to leak from used labels (e.g.
jump tables in `.rodata`) into debug sections
- Passes `startBlock` and `endBlock` from the parser into `LabelContext`
instead of using hardcoded inline regexes, and clears `currentLabelSet`
on `endBlock`

## Test plan
- [x] Added `bug-8364.asm` test case with a jump table followed by
`.debug_loclists` section
- [x] Verified debug labels appear in unfiltered output but are excluded
from directive+label filtered output
- [x] Full test suite passes (2106 tests, no regressions)
- [x] TypeScript type check clean
- [x] Lint clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:11:08 -06:00
Matt Godbolt
ddb0266645 Convert propscheck.py to TypeScript/Vitest tests (#8404)
## Summary

Replaces the Python `propscheck.py` validation script with TypeScript
code that:
- Uses a testable validator module (`lib/properties-validator.ts`)
- Has comprehensive unit tests (71 tests in
`test/properties-validation-tests.ts`)
- Integrates with the existing property loading infrastructure
- Runs as part of the normal test suite

## Changes

- **New validator module** (`lib/properties-validator.ts`):
- Raw file validation: duplicate keys, empty list elements, typos,
suspicious paths
  - Orphan detection: compilers, groups, formatters, tools, libraries
  - Cross-file duplicate compiler ID detection
  - Disabled allowlist support (`# Disabled: id1 id2`)
- Invalid property format detection (leverages `parseProperties()` with
new `collectErrors` option)
  - Missing compilers list detection for language files

- **Property library enhancement** (`lib/properties.ts`):
- Added `collectErrors` option to `parseProperties()` for structured
error collection

- **New npm script**: `npm run test:props` for quick property validation
  - Set `CHECK_LOCAL_PROPS=true` to include `.local.properties` files

- **Updated references**:
  - CI workflow no longer calls propscheck.py
  - Pre-commit hook uses `npm run test:props`
  - CE Properties Wizard uses the new validation

- **Removed**: `etc/scripts/util/propscheck.py` and `propschecktest.py`

## Test plan

- [x] All 71 unit tests pass
- [x] Integration tests validate real config files
- [x] `npm run test:props` works standalone
- [x] CE Properties Wizard validation works
- [x] CI passes

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:03:00 -05:00
Matt Godbolt
9c27705265 Use CompilationInfo type instead of Record<any, any> in tooling (#8408)
## Summary
- Replaces `Record<any, any>` with `CompilationInfo` for the
`compilationInfo` parameter in tooling files
- The `CompilationInfo` type was already imported in 2 of 3 files but
not used
- Follows up on #8407 which fixed the same issue for `tools` type

## Files changed
- `compiler-dropin-tool.ts` - use existing import
- `sonar-tool.ts` - use existing import  
- `microsoft-analysis-tool.ts` - add import
- `test/tool-tests.ts` - cast mock objects at declaration

## Test plan
- [x] `npm run ts-check` passes
- [x] `npm run test-min` passes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 20:55:57 -05:00
Matt Godbolt
695d764cc3 Fix /api/tools/:language endpoint missing name field (#8406)
## Summary
- Fixed the `/api/tools/:language` API endpoint to correctly return the
`name` field
- The `BaseTool` class stores tool properties in a nested `tool`
property, but the API handler was incorrectly accessing `name`,
`languageId`, and `stdinHint` directly on the class instance instead of
via `tool.tool.*`
- Added tests to verify the tools endpoint returns the expected fields

Fixes #8399

## Test plan
- [x] Added unit test that verifies `name` field is included in response
- [x] Added test for empty tools list
- [x] All existing tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 20:18:38 -05:00
Matt Godbolt
f46ad30286 Support absolute paths in temp directory creation (#8403)
## Summary
- When an absolute path prefix is provided to `temp.mkdir()` or
`temp.mkdirSync()`, use it directly instead of joining with
`os.tmpdir()`
- This supports use cases where compilers need temporary directories in
specific locations (e.g., shared NFS drives for remote compilation)
- Existing callers all use relative prefixes, so this is fully backwards
compatible

## Test plan
- [x] Added tests for both `mkdir` and `mkdirSync` with absolute paths
- [x] Verified existing tests still pass
- [x] Checked all callers use relative paths (no behaviour change)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:35:48 -05:00
Tony Cook
3d4fc27de0 Add the perl language (#8351)
Based on
https://github.com/KaceCottam/compiler-explorer/commits/language-perl/
rebased, modernized and captures the generated perl op codes.

<img width="1569" height="878" alt="image"
src="https://github.com/user-attachments/assets/4d131097-d258-419b-86c9-1a56c16f9ce2"
/>

---------

Co-authored-by: Kace Cottam <kaceac1@hotmail.com>
2026-01-25 16:50:12 -05:00
Patrick Quist
b7a44e62b5 Add /noscript/clientstate/ endpoint for noscript mode (#8385) 2026-01-18 16:46:29 +01:00
Matt Godbolt
5b7468293d Fix externalparser properties not surviving prediscovery serialization (#8359)
## Summary
- Fix externalparser not working with prediscovered compilers (e.g.,
MicroPython)
- The `externalparser.props` function was lost during JSON
serialization, causing `exe` path to be undefined
- Now stores `exe` and `args` directly on the externalparser object
- Removes the unused `props` function pattern from externalparser
- Adds proper TypeScript typing for externalparser
- Improves error messages to include compiler ID
- Adds delay before process.exit to allow Loki logs to flush

## Test plan
- [x] TypeScript type check passes
- [x] Linter passes  
- [x] Unit tests pass
- [ ] Deploy to staging and verify MicroPython compilers work

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 07:26:40 -06:00
narpfel
6ac2826949 Make quickfix suggestions clickable in the compiler output pane (#8354)
This makes quickfix suggestions applicable by clicking on the compiler
output line that contains the suggestion.

Example (https://godbolt.org/z/7EsbGM4r7):
<img width="912" height="581" alt="clickfixes"
src="https://github.com/user-attachments/assets/a579b6c5-947e-489c-b7e1-60ea2b79294b"
/>

The little <kbd>💡</kbd> icon indicates that a line contains a quickfix.

Requested in #5284.
2025-12-29 20:50:55 -06:00
narpfel
8afd059943 Fix linking Rust error messages to source (#8345)
The compiler output pane only links error messages to the source editor
when a filename is given. `parseRustOutput` didn’t parse the filename,
so Rust error messages were never linked.

This PR also simplifies the regex used to parse the `-->
filename:line:column` line in the `rustc` output. As far as I’m aware
(and I checked the history of the corresponding output in the `rustc`
source), the output format will always be `--> filename:line:column` and
not anything else accepted by the previous regex (no parentheses around
the line number, the column is not optional).
2025-12-20 13:54:45 +02:00
nrdmn
4bcd8e2b52 Don't double escape metadata (#8296)
Before this PR, source code in the `<meta name="description">` and
`<meta property="og:description">` tags would be doubly escaped, leading
to html escaped code showing up in link previews. Examples:

Discord:
<img width="465" height="167" alt="discord"
src="https://github.com/user-attachments/assets/d2f867e6-f724-4177-8f1d-17986d13343f"
/>

Akkoma:

![akkoma](https://github.com/user-attachments/assets/22b11c48-1bef-4424-a70a-3948213a8354)


This fixes it by removing one layer of escaping.
2025-12-15 17:50:07 -06:00
Matt Godbolt
d2cc7118aa Minor updates and lint and format fixes (#8327) 2025-12-09 22:16:59 -06:00
Frank Leon Rose
e35662fbb5 Fix Clojure dependencies (#8249) 2025-11-27 17:29:43 +01:00
Patrick Quist
194a6c8df6 Add GOCACHE support for Go compiler with writeable cache directory (#8283) 2025-11-25 00:55:45 +01:00
Cliff Burdick
27a89e86bc Fix braces on PTX parser (#8248)
The PTX emitted can sometimes be of the form:
```
{ code
}
```

Later on if the parser sees that the current and last line were closing
and opening braces, it drops both lines. This prevents any single-line
instructions from showing up. This PR changes the logic to make opcodes
on the same line as opening braces valid, and also adds unit tests for
matching.
2025-11-05 12:06:54 -06:00
Matt Godbolt
65e4f302b7 URL serialization refactoring and Cypress test improvements (#8215)
## Summary
This PR makes URL serialization logic available to Node.js contexts
(like Cypress tests) and replaces a hard-coded 4812-character base64 URL
in tests with programmatically generated state. This builds on the
shared utilities refactoring from #8246.

### Changes

#### 1. Extract URL Serialization to Shared Module
**Problem:** URL serialization code depended on GoldenLayout's
browser-only ConfigMinifier, preventing Cypress spec files from
importing it (they load in Node.js before running in browser).

**Solution:** Created `shared/url-serialization.ts` with a
Node-compatible ConfigMinifier reimplementation.

**Technical Details:**
- Reimplemented GoldenLayout's ConfigMinifier without browser
dependencies
- Moved serialization functions (`serialiseState`, `deserialiseState`,
`risonify`, `unrisonify`) to shared module
- Moved minification functions (`minifyConfig`, `unminifyConfig`) to
shared module
- Updated `static/url.ts` to use shared module instead of GoldenLayout
- Added comprehensive test coverage in `test/url-serialization.ts`

**Files:**
- **New:** `shared/url-serialization.ts` (~279 lines)
- **Modified:** `static/url.ts` (removed ~30 lines, eliminated
GoldenLayout dependency)
- **New:** `test/url-serialization.ts` (~96 lines)

#### 2. Replace Hard-coded Cypress URL with Programmatic State
**Before:** A hard-coded 4812-character base64 URL containing state for
all panes
```typescript
cy.visit('http://localhost:10240/#z:OYLghAFBqd5TB8IAsQGMD2ATApgUWwEsAXTAJwBoiQIAzIgG...');
```

**After:** Programmatically generated state using
`buildKnownGoodState()` function
```typescript
const state = buildKnownGoodState();
const hash = serialiseState(state);
cy.visit(`http://localhost:10240/#${hash}`, {...});
```

**Benefits:**
- Human-readable, maintainable test state
- Programmatic generation from `PANE_DATA_MAP` keys
- Layout optimized with 8 panes per row
- Produces identical compressed URL format
- Much easier to add/modify panes in the future

#### 3. PANE_DATA_MAP Consistency Improvements
Updated `PANE_DATA_MAP` to use component names exactly as registered
with GoldenLayout:

**Key renames:**
- `preprocessor` → `pp`
- `llvmir` → `ir` 
- `pipeline` → `llvmOptPipelineView`
- `mir` → `rustmir`
- `hir` → `rusthir`
- `macro` → `rustmacroexp`
- `core` → `haskellCore`
- `stg` → `haskellStg`
- `cmm` → `haskellCmm`
- `dump` → `gccdump`
- `tree` → `gnatdebugtree`
- `debug` → `gnatdebug`

**Added panes:** `codeEditor`, `compiler`, `conformance`, `output` (were
missing from map)

**Re-enabled tests:**
- `yul` pane test (was commented out, now fixed)
- `clojuremacroexp` pane test (was commented out, now fixed)
- `cfg` pane test (had TODO, now removed)

**Why this matters:** The `buildKnownGoodState()` function uses
`Object.keys(PANE_DATA_MAP)` as the `componentName` property, so keys
must match the actual registered component names for GoldenLayout to
find them.

## Test Plan
- [x] All Cypress tests pass (confirmed by @mattgodbolt)
- [x] TypeScript compilation passes (`npm run ts-check`)
- [x] Linting passes (`npm run lint`)
- [x] URL serialization tests pass (3/3 tests)
- [x] Pre-commit hooks pass
- [x] Related vitest tests pass

## Dependencies
- Builds on #8246 (shared utilities refactoring - already merged)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 14:09:01 -06:00
Matt Godbolt
03d20c5fde Move assert.ts and rison.ts to shared/ directory (#8246)
## Summary
Moves `static/assert.ts` and `static/rison.ts` to `shared/` directory to
make them available to both frontend and backend code without browser
dependencies. Updates all import paths across the codebase (~47 files).

## Motivation
This refactoring eliminates browser dependencies in these utilities,
allowing them to be imported by Node.js contexts (like Cypress test
files) without causing module load failures. This is a prerequisite for
upcoming Cypress test improvements.

## Changes
- Move `static/assert.ts` → `shared/assert.ts`
- Move `static/rison.ts` → `shared/rison.ts`  
- Update `biome.json` to allow `hasOwnProperty` in `shared/` directory
- Update all imports across `static/`, `lib/`, and `test/` directories
(47 files changed)

## Benefits
- No functional changes, purely a code reorganization
- Makes these utilities accessible to both frontend and backend without
circular dependencies
- Enables future Cypress improvements that require these utilities in
Node.js context
- All tests pass ✓ (699 tests)

## Test Plan
- [x] TypeScript compilation passes
- [x] Linting passes
- [x] All unit tests pass (699 tests)
- [x] Pre-commit hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 10:58:11 -06:00
LJ
5a15d893d7 Add support for Yul intermediate view when compiling Solidity (#8219)
## What

Adds support for seeing Yul (Solidity IR) as intermediate output when
compiling Solidity.

This PR also enables that view for the Resolc compiler.

### Main Additions

- [x] Support viewing Yul in a supplementary view
- Solidity compilers can enable this by setting
`this.compiler.supportsYulView = true` in the compiler's constructor
- If custom processing of the Yul output or the Yul output filename is
needed, the compiler can override `processYulOutput()` or
`getYulOutputFilename()`
- [x] Enable the Yul view for Resolc
- [x] Implement a Yul backend option for filtering out debug info from
the output

### Notes

Source mappings are currently not handled for Yul -> Solidity.

## Overall Usage

### Steps

* Choose Solidity as the language
* Choose a Resolc compiler
* View intermediate results:
  * Yul
* (Hide/show debug info by toggling "Hide Debug Info" in the Yul view
filters)

## Screenshots

<img width="1502" height="903" alt="ce-yul-view"
src="https://github.com/user-attachments/assets/ccc897e2-cd8d-4c33-962c-522d60b63134"
/>
2025-11-04 09:00:19 -06:00
Matt Godbolt
9b76c60701 Update vitest to 4.0.1 and fix test mocking for constructor support (#8213)
## Summary
- Updates vitest and @vitest/coverage-v8 from 2.1.8 to 4.0.1
- Fixes test mocks to work with vitest 4.0's constructor support
requirements

## Changes
Vitest 4.0 now supports `vi.fn()` being used as constructors, which
means arrow functions can no longer be used in mock implementations that
will be called as constructors.

### Key refactorings:
- **Class-based mocks in vi.mock()**: Defined mock classes directly in
`vi.mock()` factories instead of using `.mockImplementation()` with
arrow functions
- **Shared mock implementations**: Created shared `vi.fn()` instances
that can be configured per-test, avoiding the need for
`.mockImplementation()`
- **Biome linter compatibility**: The approach avoids
`.mockImplementation()` entirely, preventing biome from converting
`function` keywords back to arrow functions

### Files changed:
- `package.json`, `package-lock.json`: vitest version updates
- `test/app/config-tests.ts`: Refactored CompilerProps mocks with shared
cePropsImpl
- `test/app/main-tests.ts`: Refactored all constructor mocks
(CompilerFinder, FormattingService, CompileHandler, etc.)

## Test plan
- [x] All tests pass with `npm run test-min`
- [x] Linter passes with `npm run lint`  
- [x] Type checking passes with `npm run ts-check`
- [x] Pre-commit hooks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-04 08:55:58 -06:00
Ofek
901b7e1826 Fix for win32 link-binary (#8236)
(+ a rename).
Turns out when 'Link to Binary' was checked, msvc objdumped the obj (not
exe) file. This fixes it.
2025-11-01 12:54:31 +02:00
narpfel
938d0e5d14 Make instruction set parsing compatible with file >= v5.46 (#8226)
The identifier for 32-bit Intel ELF files was changed in `file` v5.46:
45702aaa99.
2025-10-28 18:01:23 +01:00
Matt Godbolt
4080457f2c Minor library updates (#8209)
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-22 11:36:33 -05:00
Frank Leon Rose
b9dc265973 Clojure language support (#8146)
<img width="1405" height="474" alt="Clojure in Compiler Explorer 2"
src="https://github.com/user-attachments/assets/76dfed9b-d0eb-4764-b371-9c6023088a50"
/>

With Macro Expansion:
<img width="1642" height="594" alt="image"
src="https://github.com/user-attachments/assets/8b511af9-3617-426e-868d-5a99e5db5756"
/>

TODO
- [x] Language configuration
- [x] Compile via wrapper
  - Inject namespace if necessary to simplify minimal code sample
  - Parse Unix style command line parameters into compiler bindings
  - Place file in path according to namespace
- [x] Install some versions of Clojure [PR
here](https://github.com/compiler-explorer/infra/pull/1849)
- [x] Macroexpansion view (modeled on Rust macro expansion view)
- [x] Filter out command line options that would break wrapper operation
- [x] ~~Parse `--help` output to a list of options~~ Reverted because
not applicable.
- [x] Short form compiler options
- [x] Support Clojure compiler settings via env var, like
`JAVA_OPTS=-Dclojure.compiler.direct-linking=true
-Dclojure.compiler.elide-meta=[:doc,:file]`

NOT DOING
- [x] ~~Support loading dependencies~~ Non-trivial enhancement. Not
necessary for initial release.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-22 09:04:20 -05:00
LJ
066a942cbc Add Resolc 0.4.0 compiler for Solidity and Yul (#8164)
## What

Adds [Revive's Resolc](https://github.com/paritytech/revive) compiler
for compiling Solidity and Yul (Solidity IR) to RISC-V and PolkaVM
assembly.

### Main Additions

- [x] Implement new `ResolcCompiler`
- [x] Implement Yul language definition and config for Monaco
- [x] Add Resolc as a compiler for the Solidity and Yul languages
  - The `ResolcCompiler` handles both kinds of language input 
- [x] Implement initial `PolkaVMAsmParser` (no source mappings)
- [x] Enable viewing LLVM IR in a supplementary view
- [x] Implement a new LLVM IR backend option for toggling between
optimized and unoptimized ll
- Affects non-resolc files ([see
commit](606bab9a59))
  - Disabled by default
- (Enable by setting `this.compiler.supportsIrViewOptToggleOption =
true` in a compiler's constructor)
- The compiler's `getIrOutputFilename()` will receive the LLVM IR
backend options

### CE Infra

Accompanying CE Infra PR:
https://github.com/compiler-explorer/infra/pull/1855

## Overall Usage

### Steps

(See screenshots)

* Choose between two input languages:
  * Solidity
  * Yul (Solidity IR)
* Choose a Resolc compiler
* View assembly:
  * PolkaVM assembly (if enabling "Compile to binary")
  * RISC-V (64 bits) assembly
* View intermediate results:
  * Optimized LLVM IR (if enabling "Show Optimized" in the LLVM IR view)
  * Unoptimized LLVM IR

### Notes

Source mappings currently only exist between:
- Yul and RISC-V
- Yul and LLVM-IR

## Screenshots

<img width="1502" height="903" alt="CE Yul RISC-V LLVM IR"
src="https://github.com/user-attachments/assets/7503b9b5-0f2c-4ddf-9405-669e4bdcd02d"
/>

<img width="1502" height="903" alt="CE Solidity PolkaVM"
src="https://github.com/user-attachments/assets/eeb51c99-3eaa-4dda-b13c-ac7783e66cb8"
/>

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-14 13:56:59 -05:00
narpfel
685f68450a Don’t add --crate-type to rust compiler options when explicitly specified by user (#8191)
Resolves #8186.
2025-10-13 14:16:01 -05:00
Ofek
00ee2fc8b0 Initial support for binary/binary-obj in msvc (#8165) 2025-10-06 18:00:53 +03:00
Matt Godbolt
8dc0cb6c94 Major update: (#8158)
- bump pQueue:
https://github.com/sindresorhus/p-queue/releases/tag/v9.0.0
  - throwOnTimeout is removed (and is always `true`)
- 0 is not a valid timeout, so, updated tests to pass a big number (no
normal code path assumes 0)
- happy dom: breaking changes: removed commonjs, new jest; nothing
affects us
2025-10-02 14:05:56 -05:00
Ofek
1268377689 Fix #3491: improve MSVC asm filtering (#8154) 2025-10-02 01:59:18 +03:00
Ofek
5eb5262c64 Various type improvements, mostly in tests (#8144) 2025-09-27 10:17:55 +03:00
Ofek
5a7b0c27a4 Add CFG for MSVC compilers (#8134) 2025-09-25 00:23:36 +03:00
Patrick Quist
102c74c09b fix tool invokations include paths for libraries (#8096) 2025-09-12 15:23:55 -05:00
Matt Godbolt
f824efe73e Library updates and lint fixes (#8099)
* Minor updates only
* Added explicit radix parameter (10) to all Number.parseInt() calls throughout the codebase (new lint rule)
* Updated several @ts-ignore comments to @ts-expect-error for better TypeScript practices (new lint rule)
* Removed unnecessary @ts-ignore comments in some mode files (ditto)
* Used "none return" based arrow functions for some map stuff
* Replaced a `map()` call that didn't return anything to a for() loop
* Fixed up some cypress stuff, noting work for the future
2025-09-12 14:23:49 -05:00
narpfel
63faf792ba Fix jump to label with symbols containing $ (#8051)
For example Rust will mangle `<` to `$LT$`:
https://godbolt.org/z/86n9M6P3f
2025-08-25 21:19:07 -05:00
Ofek
96103f044f Fix #8000: stop forcing dwarf 4 (#8036) 2025-08-16 17:39:09 +03:00