Skip to content

build: require LLVM 20, since LLVM 19 no longer compiles the analyzer - #260

Merged
SizzleUnrlsd merged 7 commits into
mainfrom
build/require-llvm-20
Nov 1, 2026
Merged

SizzleUnrlsd merged 7 commits into
mainfrom
build/require-llvm-20

Conversation

@SizzleUnrlsd

@SizzleUnrlsd SizzleUnrlsd commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The analyzer has not compiled with LLVM 19 since 33fe390, yet CMake still accepts LLVM 19 and scripts/build.sh still looks for it. This PR raises CMake's minimum LLVM version to 20, makes scripts/build.sh look for Homebrew llvm@20 first, and updates the documents that name an LLVM version.

What breaks

  • 33fe390 (feat(resource-lifetime): MissingRelease from the ownership engine) reads the callee's captures attribute in src/analysis/ownership/ResourceFactCollector.cpp (lines 955 to 966) through llvm::CaptureInfo, llvm::CaptureComponents, llvm::capturesNothing and llvm::Argument::getAttributes(). All four first appear in LLVM 20, along with the captures attribute itself.
  • Checked with g++ -fsyntax-only against apt.llvm.org's packages, that file has 9 errors with LLVM 19.1.7, all in those lines, and none with LLVM 20.1.8.
  • CMakeLists.txt sets LLVM_MIN_REQUIRED_VERSION to 19, so a build with LLVM 19 passes configuration and fails during compilation. Every CI job installs LLVM 20, so none of them saw it.
  • On macOS, scripts/build.sh takes the first Homebrew formula it finds among llvm, llvm@20, llvm@19 and llvm@18. Homebrew's llvm formula is LLVM 23.1, and the analyzer does not build with LLVM 21 (Build and test with LLVM 21 (Ubuntu 26.04 runners) #259), so with llvm and llvm@20 both installed, the script picks llvm.

Change

  • CMakeLists.txt: the version check requires LLVM 20, in new and existing build directories alike. With LLVM 19, configuration now stops with LLVM version 19.1.7 found, but version 20 or higher is required. The minimum goes straight to check_llvm_version, instead of through the LLVM_MIN_REQUIRED_VERSION cache variable: set(CACHE) keeps a value already in the cache, so a build directory configured before this change would have kept 19. Nothing in the repository set that variable; a command line that still passes it gets CMake's warning about unused variables.
  • scripts/build.sh: on macOS, the script looks for llvm@20, then llvm. It no longer looks for llvm@19 or llvm@18, which CMake would reject.
  • CONTRIBUTING.md lists LLVM/Clang 20 instead of >= 19 (20 recommended). The README's build section states that the analyzer builds with LLVM and Clang 20, and how to install them on macOS and Ubuntu.
  • CHANGELOG.md: an entry for this change, and one for fix(action): diagnose unsupported Ubuntu LLVM versions #257, which made the GitHub Action accept LLVM 20 only and added no entry.

Not in this PR

  • CMake sets no maximum version: it still accepts LLVM 21 and later, which fail during compilation. Build and test with LLVM 21 (Ubuntu 26.04 runners) #259 tracks LLVM 21 support.
  • On Linux, scripts/build.sh picks the first /usr/lib/llvm-* directory in alphabetical order, so with the development files of LLVM 18 or 19 next to those of LLVM 20, it picks the older version. CMake now rejects it at configuration, with the error above.

Verification

CMake, configured on macOS:

  • With a stub LLVM package that reports version 19.1.7, configuration passed the version check before this change (Checking for LLVM >= 19..., then Found LLVM 19.1.7). It now stops with LLVM version 19.1.7 found, but version 20 or higher is required.
  • In a build directory first configured from main with that stub package, reconfiguring with this PR's first version of CMakeLists.txt (aa648dc) still printed Checking for LLVM >= 19... and accepted it, because the cache kept 19. Reconfiguring with the current version stops with the error above.
  • With Homebrew's LLVM 18.1.8, it stops with the same error, for 18.1.8.
  • With Homebrew's LLVM 20.1.2 and the options CI passes, configuration and generation complete. Adding -DLLVM_MIN_REQUIRED_VERSION=19 only produces CMake's warning about unused variables.

scripts/build.sh --configure-only, run with stub brew and cmake commands, passes CMake the directories of these formulas:

Homebrew formulas installed Before After
llvm and llvm@20 llvm llvm@20
llvm only llvm llvm
llvm@19 only llvm@19 none: the script stops with LLVM_DIR not found
llvm@18 and llvm@20 llvm@20 llvm@20

CI does not run scripts/build.sh, and every job builds with LLVM 20, so this PR's own run checks that the new minimum accepts it.

…nalyzer

Since 33fe390, src/analysis/ownership/ResourceFactCollector.cpp reads
the callee's `captures` attribute through llvm::CaptureInfo,
llvm::CaptureComponents, llvm::capturesNothing and
llvm::Argument::getAttributes(), which LLVM 20 introduced. CMake still
accepted LLVM 19, so a build with it passed configuration and then
failed to compile that file. Configuration now stops with the error of
check_llvm_version instead.
CMake now requires LLVM 20, so the script would only hand it a version
that configuration rejects.
The script takes the first formula it finds, and it tried `llvm` first.
Homebrew's `llvm` formula is LLVM 23.1 as of this change, while the
analyzer builds with LLVM 20 only (LLVM 21 is tracked in #259), so with
both formulas installed the script picked the wrong one. `llvm` stays
as the fallback.
The prerequisites still listed LLVM 19 as the minimum, with 20
recommended.
The build section named no LLVM version. It now names the one the
analyzer builds with, and how to install it on macOS and Ubuntu.
The second entry covers the action change of #257, which added no
changelog entry.
… before

LLVM_MIN_REQUIRED_VERSION was a cache variable, and set(CACHE) keeps a
value that the cache already holds. A build directory configured before
the floor moved to 20 kept 19, so running ./build.sh again after an
update still accepted LLVM 19, and the build failed during compilation.
check_llvm_version now receives 20 directly, on every configuration.
Nothing in the repository set the variable; a command line that still
passes it gets CMake's warning about unused variables.
@SizzleUnrlsd
SizzleUnrlsd merged commit 703da23 into main Nov 1, 2026
15 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the build/require-llvm-20 branch November 1, 2026 19:15
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