Repository navigation
perf: leave clang-analyzer-* out of the default --tidy-checks - #561
Conversation
The Clang Static Analyzer checks can make clang-tidy many times slower (see #518). clang-tidy 22 removed them from its own defaults, but our default added them back. Users can still enable them in a .clang-tidy file or with --tidy-checks. Document the change in the CLI help and the migration guide, including that clang-tidy 21 and older still enable them by default. Part of #518
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #561 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 29 29
Lines 7671 7671
=======================================
Hits 7663 7663
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Part of #518 (item 1, which @2bndy5 agreed to in the issue). Items 2 and 3 (result cache, compile DB dedup) are not touched here.
What changes
--tidy-checksno longer containsclang-analyzer-*. Everything else in the default stays the same.--tidy-checkshelp (and socli.md) says why and how to turn the analyzer back on.Effect per clang-tidy version
--tidy-checksis appended to clang-tidy's ownChecks, so this PR only stops cpp-linter from adding the analyzer. It does not force it off:.clang-tidyfile or--tidy-checksenables it. (LLVM 22 removed it from clang-tidy's defaults; our default was adding it back.)clang-analyzer-*. The docs say to add-clang-analyzer-*to turn it off there.I did not put
-clang-analyzer-*into the default, because it would also turn off the analyzer for users whose.clang-tidyenables it.Tests
About the concern in #518 that tests might expect analyzer findings: the test assets (
tests/demo,tests/reviews_test_assets) have a.clang-tidythat enablesclang-analyzer-*, so their results do not change. No test asserts the default value.cargo nextest run --package cpp-linter --package clang-tools-manager --features bin --lib --tests --profile allwithCLANG_VERSION=18: 279 passed, 1 skipped.--profile ciandCLANG_VERSION=23: 44 passed.cargo clippy --all-features --all-targets -- -D warnings,cargo fmt --check, and pre-commit (incl. cspell) on the changed files: clean.Manual check
A file with a null dereference (
clang-analyzer-core.NullDereference), no.clang-tidy,-l false -f false -s '', release builds ofmainand this branch:main-V 22)-V 23)-V 23andclang-analyzer-*added back to--tidy-checks: reported again.-V 23and a.clang-tidyofChecks: 'clang-analyzer-core.*': reported.-V 18and-clang-analyzer-*added: not reported.<regex>,<map>, ...) with-V 23: about 5.4–6.0 s onmain, 1.5–1.9 s with this PR.Not in this PR
cpp-linter-action's
tidy-checksdefault still containsclang-analyzer-*. #518 asks whether the action should follow; that is a separate change in the action repo.Summary by CodeRabbit
--tidy-checkslist no longer includesclang-analyzer-*checks. With clang-tidy 22 and newer, these checks are omitted by default; versions 21 and older may still enable them unless explicitly disabled.