Move CI static analysis and sanitizers to LLVM 22 and add an opt-in clang-tidy pre-commit hook - #182
Merged
Merged
Conversation
CI ran clang-tidy 21 while .clang-tidy already referenced a check that only exists in clang-tidy 22 and clang-format was pinned to 22, so local and CI runs could disagree on the check set. Move every pin to 22: - clang-tidy.yml and iwyu.yml: COMPILER_VERSION 22 (IWYU has a clang_22 branch). - docker/Dockerfile: install clang-tidy-22 (the unversioned package on Ubuntu 26.04 is 21) and symlink it as clang-tidy so CMake finds it. - FindClangTidy.cmake: prefer clang-tidy-22, and warn at configure time when the found major version differs from ClangTidy_EXPECTED_MAJOR_VERSION. - cmake.yml: add Clang-22 (C++20 and C++23) matrix entries. Add a manual-stage pre-commit hook that runs the same `./scripts/cmake.sh --debug --clang-tidy` build as CI, so there is one documented local invocation without a full build on every commit. Being manual-stage, it is skipped by `pre-commit run --all-files` in CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QHjiPBayDu7hLZyhcQK3tt
Clang 22 warns that __COUNTER__ is a C2y extension, and benchmark builds its own sources with -Werror -pedantic-errors, so v1.9.1 failed to compile in the new Clang-22 matrix jobs. v1.9.5 suppresses the warning around its __COUNTER__ probe. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QHjiPBayDu7hLZyhcQK3tt
The entry asked setup-clang for version 19 and then compiled with clang-20, which only worked because the runner image already ships it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QHjiPBayDu7hLZyhcQK3tt
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QHjiPBayDu7hLZyhcQK3tt
philipcraig
marked this pull request as ready for review
August 27, 2026 14:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clang TidyandIWYUworkflows,docker/Dockerfile(clang-tidy-22+clang-tidysymlink), andcmake/modules/FindClangTidy.cmake(prefersclang-tidy-22, warns on a major-version mismatch with CI).cmake.ymlbuild matrix, and fix the Clang-20 entry, which askedsetup-clangfor version 19 and only worked because the runner image already ships clang-20.__COUNTER__is a C2y extension (-Wc2y-extensions), and benchmark compiles its own sources with-Werror -pedantic-errors, so v1.9.1 failed to build in the new Clang-22 jobs. v1.9.5 suppresses the warning around its__COUNTER__probe.clang-tidythat runs./scripts/cmake.sh --debug --clang-tidy, invoked withuv run pre-commit run --hook-stage manual clang-tidy. It is skipped by the defaultpre-commit run --all-files, so thepre-commitCI job is unaffected.CONTRIBUTING.md.Why
.clang-tidyalready disablescppcoreguidelines-pro-bounds-avoid-unchecked-container-access, which only exists in clang-tidy 22, and clang-format is pinned to 22, while CI analysed with 21. clang-tidy silently ignores unknown check names, so nothing broke, but local and CI runs used different check sets.Test plan
uv run pre-commit validate-configanduv run pre-commit run --all-filespass; theclang-tidyhook is not run at the default stage.uv run pre-commit run --hook-stage manual clang-tidyruns the full build.FindClangTidy.cmakeversion warning verified with a stubclang-tidyreporting 21.1.6../scripts/cmake.sh --debug --cleanwith benchmark v1.9.5: 87/87 tests pass.Clang Tidyworkflow passes on LLVM 22 with zero new findings.IWYUworkflow builds from theclang_22branch and passes.docker/Dockerfilechange verified in a rebuilt Codespace:clang-tidyresolves toclang-tidy-22(LLVM 22.1.2), CMake selects it with no version warning, the manual hook passes on a clean build, and an injected in-tree finding is rejected.🤖 Generated with Claude Code
https://claude.ai/code/session_01QHjiPBayDu7hLZyhcQK3tt