llvm / llvm/llvm-project

[clang-tidy] Wildcards don't work with certain clang-analyzer-core* checks

Open
#206,898 9 comments 0 reactions 0 assignees View on GitHub
clang-tidy clang:static analyzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Output of `--checks=clang-analyzer-core* -list-checks`:
```
Enabled checks:
clang-analyzer-core.BitwiseShift
clang-analyzer-core.CallAndMessage
clang-analyzer-core.DivideZero
clang-analyzer-core.DynamicTypePropagation
clang-analyzer-core.NonNullParamChecker
clang-analyzer-core.NonnilStringConstants
clang-analyzer-core.NullDereference
clang-analyzer-core.NullPointerArithm
clang-analyzer-core.StackAddressEscape <=================
clang-analyzer-core.UndefinedBinaryOperatorResult
clang-analyzer-core.VLASize
clang-analyzer-core.builtin.AssumeModeling
clang-analyzer-core.builtin.BuiltinFunctions
clang-analyzer-core.builtin.NoReturnFunctions
clang-analyzer-core.uninitialized.ArraySubscript
clang-analyzer-core.uninitialized.Assign
clang-analyzer-core.uninitialized.Branch
clang-analyzer-core.uninitialized.CapturedBlockVariable
clang-analyzer-core.uninitialized.NewArraySize
clang-analyzer-core.uninitialized.UndefReturn
```
Yet an expected `StackAddressEscape` warning doesn't show up when `-list-checks` is removed.
Wildcards seem to work with e.g. `clang-analyzer-unix*`.
https://godbolt.org/z/jhjj8GEEn

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Godbolt example with clang-tidy and compare --checks=clang-analyzer-core* with and without -list-checks. Trace how clang-analyzer check patterns are matched and how StackAddressEscape is selected; done means the wildcard both lists and enables the expected warning without -list-checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.