Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f4719a7
build: modernize LLVM build and release workflow
16bit-ykiko Jun 30, 2026
0a44c74
fix: remove LLVM 22-only libs from link deps for 21.1.8 compat
16bit-ykiko Jun 30, 2026
39b8dd1
build: update manifest to 21.1.8+r1 and remove temp push trigger
16bit-ykiko Jun 30, 2026
1129869
fix: address review findings for build infra PR
16bit-ykiko Jun 30, 2026
43d49e8
ci: upgrade actions to match main (checkout@v7, upload@v7, download@v8)
16bit-ykiko Jun 30, 2026
873ef2d
docs: remove stale skip flag note from upgrade-llvm skill
16bit-ykiko Jun 30, 2026
5595d49
refactor: simplify build infrastructure and normalize manifest
16bit-ykiko Jun 30, 2026
bcc33d7
build: update manifest from release-llvm with flat array format
16bit-ykiko Jun 30, 2026
0d5ad4c
ci: always update release notes with latest build run link
16bit-ykiko Jun 30, 2026
cee125e
fix: address review findings for build infra PR
16bit-ykiko Jun 30, 2026
3523188
fix: address review findings for build infra PR
16bit-ykiko Jun 30, 2026
57a1b77
build: flatten LLVM archive layout and remove workarounds
16bit-ykiko Jun 30, 2026
c92dca1
build: unify artifact names to arm64, add concurrency groups
16bit-ykiko Jun 30, 2026
f1b8157
ci: retrigger build-llvm after cancellation
16bit-ykiko Jun 30, 2026
bee11ce
ci: remove temp push trigger from build-llvm
16bit-ykiko Jun 30, 2026
38d1b94
fix: update discover paths for flattened LLVM archive layout
16bit-ykiko Jun 30, 2026
92a3859
build: update manifest from release-llvm with arm64 naming and flat l…
16bit-ykiko Jun 30, 2026
74d69b6
fix: address review findings for build infra PR
16bit-ykiko Jul 1, 2026
db55ea7
refactor: remove llvm-manifest.json, compute artifact URL directly
16bit-ykiko Jul 1, 2026
0e752a8
fix: remove dead apply subcommand, reject unknown CPU arch
16bit-ykiko Jul 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions .claude/commands/upgrade-llvm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
Upgrade LLVM to a new version. Accepts the target version as argument (e.g., `22.1.4`).

This is the complete workflow for upgrading the LLVM prebuilt packages that clice depends on. Follow each step in order. Steps that involve CI should use polling (check every ~5 minutes) to wait for completion.

## Step 1: Trigger LLVM Build

Trigger the `build-llvm` workflow on GitHub Actions:

```bash
gh workflow run build-llvm.yml \
--field llvm_version="<VERSION>"
```

- Poll until all 14 matrix builds complete (~2-3 hours), note the workflow run ID

## Step 2: Download Local Platform Artifact

Download the artifact matching the development machine:

```bash
gh run view <RUN_ID>
gh run download <RUN_ID> -n x64-linux-gnu-releasedbg.tar.xz -D .llvm-download
mkdir -p .llvm
tar -xf .llvm-download/x64-linux-gnu-releasedbg.tar.xz -C .llvm
```

Configure clice to build against it:

```bash
pixi run cmake-config RelWithDebInfo ON -- "-DLLVM_INSTALL_PATH=.llvm"
pixi run cmake-build RelWithDebInfo
```

Compilation will likely fail — that's what Step 3 addresses.

## Step 3: Adapt API Changes

Fix LLVM API breaking changes based on compilation errors. Common categories:

- **Header path changes**: e.g., `clang/Driver/Options.h` → `clang/Options/Options.h`
- **Namespace migrations**: e.g., `clang::driver::options` → `clang::options`
- **Type system changes**: e.g., ElaboratedType removal, NestedNameSpecifier pointer→value
- **Function signature changes**: e.g., `createDiagnostics` parameter changes
- **Type merges/splits**: e.g., DependentTemplateSpecializationType → TemplateSpecializationType

Strategy:

1. Fix header/namespace changes first (mechanical)
2. Fix type system and signature changes (requires understanding semantics)
3. Update test expectations (AST structure changes affect test output)
4. Ensure `pixi run unit-test RelWithDebInfo` passes

When a fix is not obvious, read the LLVM source code to understand the new API. If `../llvm-project` exists locally, use it. Otherwise, look up the upstream commit/PR on GitHub.

## Step 4: Create PR

```bash
git checkout -b chore/upgrade-llvm-XX
git add -A
git commit -m "chore: upgrade LLVM to XX.Y.Z"
git push -u origin chore/upgrade-llvm-XX
gh pr create --title "chore: upgrade LLVM to XX.Y.Z" --body "..."
```

CI will fail at this point (manifest hashes are stale) — this is expected.

## Step 5: Run Release LLVM Workflow

Trigger `release-llvm` to build pruned packages:

```bash
gh workflow run release-llvm.yml \
--ref <BRANCH> \
--field source_run_id="<STEP1_RUN_ID>" \
--field llvm_version="<VERSION>"
Comment thread
16bit-ykiko marked this conversation as resolved.
```

This will: discover unused libs → create clice-llvm release → repackage with pruning. Poll until complete.

## Step 6: Update Version

Update the version string in `cmake/package.cmake`:

```
setup_llvm("<VERSION>")
```

Commit and push:

```bash
git add cmake/package.cmake
git commit -m "chore: update LLVM to <VERSION>"
git push
```

Poll CI until all platforms pass. CMake downloads the correct artifact automatically based on the version and platform — no manifest file needed.

## Step 7: Write LLVM Changelog (REQUIRED)

**Every LLVM upgrade MUST append to `docs/en/changelog/llvm-changelog.md`.**

Add a new H2 section (e.g., `## LLVM 22 → 23`) documenting all breaking changes encountered. For each API change, record:

- Change description
- Upstream commit hash
- PR number (link to `https://github.com/llvm/llvm-project/pull/<NUM>`)
- Impact on clice

To find upstream commits, search the LLVM git history between version tags:

```bash
# If ../llvm-project exists locally:
cd ../llvm-project
git log --oneline llvmorg-<OLD>..llvmorg-<NEW> -- clang/include/clang/AST/
```

If the LLVM source is not available locally, look up changes on GitHub by searching the LLVM repository commit history.

Group changes by category (Type System, NNS, Driver/Frontend, Other) with a table per category. See the existing `LLVM 21 → 22` section as a template.

## Step 8: Report to User

Present a summary to the user and **wait for confirmation** before considering the upgrade complete. The summary should include:

- All API changes that were adapted and how they were resolved
- All test expectation changes (snapshot updates, assertion value changes) and why
- Any unavoidable behavior changes from upstream LLVM (e.g., TypePrinter output differences, type sugar changes) that affect user-visible features like hover
- The LLVM changelog that was written

The user decides whether all changes are acceptable or if adjustments are needed. Do NOT push final changes or mark the work as done until the user confirms.

## Notes

- **Artifact size limit**: GitHub Release max 2GB per file. macOS LTO artifacts are largest, currently ~1.7GB with xz -9e.
- **Pruning safety**: discover phase validates by deleting .a files one by one and rebuilding clice. clang-tidy modules can't be deleted due to force-link.
- **Private headers**: clice depends on private Clang Sema headers (TreeTransform.h etc.), copied from source during `build-llvm.py`. Users must use our packaged LLVM.
Loading