Skip to content

chore: upgrade LLVM to 22.1.8 - #586

Merged
16bit-ykiko merged 7 commits into
mainfrom
chore/upgrade-llvm-22
Aug 7, 2026
Merged

chore: upgrade LLVM to 22.1.8#586
16bit-ykiko merged 7 commits into
mainfrom
chore/upgrade-llvm-22

Conversation

@16bit-ykiko

Copy link
Copy Markdown
Member

What changed

Upgrades the prebuilt LLVM dependency from 21.1.8 to 22.1.8 and adapts clice to the LLVM 22 API. Highlights:

Behavioral changes visible in features (all matching clang/clangd 22 rendering, pinned in snapshots): __size_t (aka unsigned long) sugar, (unnamed enum) naming, namespace-qualified canonical class types in hover, and converted (qualified) template arguments in hover titles for implicit variable template specializations. One deliberate divergence from clangd: inlay type hints keep written class scopes (S2::Nested<int>) that LLVM 22's SuppressScope would now drop — restored by printing the outer node's written qualifier.

Also cherry-picks the release-triple normalization + prebuilt-respin fixes (/MT, macOS deployment target) that the 22.1.8 prebuilt was built with, and adds an LLVM 21 → 22 section to the LLVM changelog documenting every breaking change with upstream references.

Note: CI stays red until the pruned 22.1.8 clice-llvm release is published (release-llvm is running against this branch); the version pin in cmake/package.cmake will be bumped in a follow-up commit on this branch once it is up.

Tests

All four suites pass locally against the 22.1.8 prebuilt: unit (1174), integration (341), smoke (3/3), snap (393). Snapshot updates are limited to the upstream rendering changes listed above; one selection-tree unit test was re-marked because dependent qualifier chains are now DependentNameTypeLoc components with name-only ranges.

…ixes

Standardize all release artifact names to use proper target triples
(x86_64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-pc-windows-msvc,
etc.) with version numbers in filenames: clice-{ver}.{triple}.{ext}.

Apply the three TODO(prebuilt-respin) fixes validated in ci-toolchain-test:
- Windows: switch to /MT static CRT (no MSVCP140.dll/VCRUNTIME140.dll)
- macOS: set explicit CMAKE_OSX_DEPLOYMENT_TARGET=15.0
- macOS: remove conda rpath hack (prebuilt now links system libc++)

Bump LLVM to 21.1.8+r3 for the respin.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: abf2a0e4-7c86-4fdc-9c04-5201db45067f

📥 Commits

Reviewing files that changed from the base of the PR and between 665888b and 6193503.

📒 Files selected for processing (2)
  • docs/en/features/document-symbols.md
  • tests/snap/document_symbol/detail_scoped_types.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/snap/document_symbol/detail_scoped_types.cpp

📝 Walkthrough

Walkthrough

The PR upgrades clice for LLVM 22. It updates Clang APIs, semantic type resolution, hover rendering, compiler setup, target-triple naming, packaging workflows, toolchain settings, documentation, and tests.

Changes

LLVM 22 upgrade

Layer / File(s) Summary
Target-triple artifact pipeline
.github/workflows/*, cmake/llvm.cmake, cmake/package.cmake, cmake/toolchain.cmake, scripts/*
Build, test, release, and packaging workflows derive artifact names from standard target triples. LLVM versioning, ARM64 targets, runtime settings, macOS deployment settings, and manifests were updated.
Clang API integration
src/command/*, src/compile/compilation.cpp, src/syntax/scan.cpp, src/semantic/search_config.cpp
Clang option generation, resource lookup, compiler invocation setup, VFS creation, diagnostics, file management, and absolute-path handling now use LLVM 22 APIs.
Semantic AST model migration
src/semantic/*, src/index/usr_generation.cpp, docs/en/changelog/llvm-changelog.md
Nested-name specifiers use value-based APIs. Dependent template specializations use TemplateSpecializationType. Resolver, traversal, rewriting, unification, injected-class handling, and unresolved-using handling were updated.
Type rendering and validation
src/semantic/display.cpp, src/feature/hover.cpp, tests/snap/*, tests/unit/semantic/selection_tests.cpp, docs/en/features/document-symbols.md
Canonical type and qualifier rendering changed for LLVM 22. Hover, document-symbol, and selection fixtures record the updated behavior.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.37% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: upgrading LLVM to version 22.1.8.
Description check ✅ Passed The description explains the changes and motivation, documents testing, and covers the optional related-issue section appropriately.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/upgrade-llvm-22

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (2)
src/semantic/resolver.cpp (2)

517-533: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the inner name to avoid shadowing the parameter.

Line 525 declares name inside a function whose parameter is also name. The inner value is the dependent template's identifier; the outer value is the member being looked up. Both are live in the same function. A distinct identifier removes the ambiguity.

♻️ Proposed rename
-                auto name = dependent->getName().getIdentifier();
-                if(!name) {
+                auto* template_name = dependent->getName().getIdentifier();
+                if(!template_name) {
                     return {};
                 }
 
-                if(auto decl = preferred(lookup(dependent->getQualifier(), name))) {
+                if(auto decl = preferred(lookup(dependent->getQualifier(), template_name))) {
                     TD = decl;
                 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/semantic/resolver.cpp` around lines 517 - 533, Rename the inner `name`
variable in the dependent-template resolution block to a distinct identifier,
and update its use in the `preferred(lookup(...))` call; leave the function
parameter `name` unchanged.

1987-2016: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Document the non-null precondition at line 1994.

resolve_dependent_template dereferences getAsDependentTemplateName() without a check. The only caller guards it at line 819, so the code is correct today. An assert records the precondition for future callers.

🛡️ Proposed guard
-        auto& template_name = *TST->getTemplateName().getAsDependentTemplateName();
+        auto* dependent = TST->getTemplateName().getAsDependentTemplateName();
+        assert(dependent && "resolve_dependent_template requires a dependent template name");
+        auto& template_name = *dependent;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/semantic/resolver.cpp` around lines 1987 - 2016, Add an assertion in
resolve_dependent_template before dereferencing
TST->getTemplateName().getAsDependentTemplateName(), documenting that the
dependent template name must be non-null. Preserve the existing resolution flow
and caller behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-llvm.yml:
- Around line 67-72: Update all aarch64 toolchain triple references in the
workflow matrix, cmake/toolchain.cmake cache key and path logic, and
toolchain_tests.cpp to consistently use aarch64-unknown-linux-gnu, preserving
the existing build and test behavior.
- Around line 204-218: Make the llvm_version workflow input default to 22.1.8,
or validate it before the build proceeds. Update the LLVM clone and
patch-selection logic to use llvm_version instead of hardcoded 21.1.8. Update
ARCHIVE so generated package names explicitly include the selected LLVM version
and cannot be confused with artifacts from another release.

In @.github/workflows/cross-test.yml:
- Around line 16-24: Add an explicit least-privilege permissions block for the
cross-test workflow, scoped at the workflow or job level around the linux-arm64
job, granting only contents: read. Do not add broader permissions unless an
existing workflow step demonstrably requires them.

In @.github/workflows/publish-clice.yml:
- Around line 47-48: Update the artifact validation step around LIVE to query
all six required matrix artifact names, excluding expired artifacts, and verify
that every expected package artifact is present. Fail the workflow before
release creation or asset uploads when any artifact is missing or expired, while
preserving promotion only when all six artifacts are available.

In @.github/workflows/publish-vscode.yml:
- Around line 142-157: Update the Determine vsix output name and Package
platform extension steps to keep RELEASE_TAG in the environment, construct
optional output arguments in a Bash array, and pass them using quoted array
expansion. Remove the shell-evaluated steps.vsix.outputs.out interpolation while
preserving the existing versioned filename and no-tag behavior.

In `@cmake/llvm.cmake`:
- Line 39: Update the archive naming logic around _FILENAME and the
CLICE_TARGET_STRING mapping in CMakeLists.txt to use one shared canonical triple
formatter. Ensure the x86_64 Linux GNU target consistently produces
x86_64-unknown-linux-gnu in both downloadable archive identifiers and embedded
metadata.

In `@cmake/package.cmake`:
- Line 4: Update the version argument in setup_llvm to request the published
LLVM 22.1.8 package instead of 21.1.8+r3, preserving the existing package
configuration structure.

In `@src/semantic/semantics.cpp`:
- Around line 487-490: Update TraverseQualifiedTypeLoc to name and forward its
traverse_qualifier parameter when calling TraverseTypeLoc, preserving the
caller’s false value instead of always re-enabling qualifier traversal.

---

Nitpick comments:
In `@src/semantic/resolver.cpp`:
- Around line 517-533: Rename the inner `name` variable in the
dependent-template resolution block to a distinct identifier, and update its use
in the `preferred(lookup(...))` call; leave the function parameter `name`
unchanged.
- Around line 1987-2016: Add an assertion in resolve_dependent_template before
dereferencing TST->getTemplateName().getAsDependentTemplateName(), documenting
that the dependent template name must be non-null. Preserve the existing
resolution flow and caller behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25cd49da-cfb8-4c70-b4ee-6fa654c3998b

📥 Commits

Reviewing files that changed from the base of the PR and between 01c02f1 and 0d4c473.

📒 Files selected for processing (36)
  • .claude/skills/upgrade-llvm/SKILL.md
  • .github/workflows/build-llvm.yml
  • .github/workflows/cross-pair.yml
  • .github/workflows/cross-test.yml
  • .github/workflows/native-test.yml
  • .github/workflows/nightly.yml
  • .github/workflows/publish-clice.yml
  • .github/workflows/publish-vscode.yml
  • .github/workflows/release-llvm.yml
  • cmake/llvm.cmake
  • cmake/package.cmake
  • cmake/toolchain.cmake
  • docs/en/changelog/llvm-changelog.md
  • scripts/build-llvm.py
  • scripts/check_artifact_deps.py
  • scripts/release-llvm.py
  • src/command/argument_parser.cpp
  • src/command/argument_parser.h
  • src/command/search_config.cpp
  • src/compile/compilation.cpp
  • src/feature/hover.cpp
  • src/index/usr_generation.cpp
  • src/semantic/display.cpp
  • src/semantic/resolver.cpp
  • src/semantic/resolver.h
  • src/semantic/semantics.cpp
  • src/semantic/types.cpp
  • src/semantic/unifier.cpp
  • src/syntax/scan.cpp
  • tests/snap/hover/auto.snap.yml
  • tests/snap/hover/docs.snap.yml
  • tests/snap/hover/expressions.snap.yml
  • tests/snap/hover/misc.snap.yml
  • tests/snap/hover/tag_decls.snap.yml
  • tests/snap/hover/this_expr.snap.yml
  • tests/unit/semantic/selection_tests.cpp

Comment thread .github/workflows/build-llvm.yml
Comment thread .github/workflows/build-llvm.yml
Comment thread .github/workflows/cross-test.yml
Comment thread .github/workflows/publish-clice.yml Outdated
Comment thread .github/workflows/publish-vscode.yml Outdated
Comment thread cmake/llvm.cmake
Comment thread cmake/package.cmake Outdated
Comment thread src/semantic/semantics.cpp Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-llvm.yml:
- Line 159: Replace direct GitHub expression interpolation in the VERSION
assignments of both build steps with environment-variable passing, then read the
quoted shell variable inside Bash. Apply the same env-based pattern to
inputs.patch_ref in the patch step, ensuring untrusted workflow inputs cannot
alter the script syntax.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2340f90a-ea85-4de1-b5b7-2185317761a4

📥 Commits

Reviewing files that changed from the base of the PR and between 0d4c473 and e19733b.

📒 Files selected for processing (2)
  • .github/workflows/build-llvm.yml
  • cmake/package.cmake

Comment thread .github/workflows/build-llvm.yml Outdated
@16bit-ykiko

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: d1592aa5f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@16bit-ykiko
16bit-ykiko merged commit 74fea66 into main Aug 7, 2026
34 checks passed
@16bit-ykiko
16bit-ykiko deleted the chore/upgrade-llvm-22 branch August 7, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant