Commit a088e74
authored
[analyzer] Fix [[clang::suppress]] for template instantiations (#168954)
BugSuppression works by traversing the lexical decl context of the
decl-with-issue to record what source ranges should be suppressed by
some attribute.
Note that the decl-with-issue will be changed to the lexical decl
context of the original decl-with-issue, to make suppression attributes
work that were attached to the CXXRecordDecl containing the
CXXMethodDecl (bug report's DeclWithIssue).
It happens so that it uses a DynamicRecursiveASTVisitor, which has a
couple of traversal options. Namely:
- ShouldVisitTemplateInstantiations
- ShouldWalkTypesOfTypeLocs
- ShouldVisitImplicitCode
- ShouldVisitLambdaBody
By default, these have the correct values, except for
ShouldVisitTemplateInstantiations. We should traverse template
instantiations because that might be where the bug is reported - thus,
where we might have a [[clang::suppress]] that we should honor.
In this patch I'll explicitly set these traversal options to avoid
further confusion.
rdar://1646463981 parent 08f72fe commit a088e74
File tree
2 files changed
+30
-2
lines changed- clang
- lib/StaticAnalyzer/Core
- test/Analysis
2 files changed
+30
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
2 | 25 | | |
3 | 26 | | |
4 | 27 | | |
| |||
0 commit comments