Commit ca19ab9
authored
[NFCI][analyzer] invalidateRegions: require explicit State (llvm#164434)
The method `CallEvent::invalidateRegions()` takes (an unsigned
`BlockCount` and) a `ProgramStateRef` which was previously defaulted to
`nullptr` -- and when the state argument was `nullptr`, the method used
the "inner" state of the `CallEvent` as a starting point for the
invalidation.
My recent commit 0f6f13b turned the
"inner" state of the `CallEvent` into a hidden `protected`
implementation detail; so this commit follows that direction by removing
the "defaults to the inner state" behavior from `invalidateRegions` to
avoid exposing the inner state through this channel.
The method `CallEvent::invalidateRegions()` was only called in two
locations, only one of those was relying on the existence of the default
argument value, and even there it was easy to explicitly pass the
`State` object.
This commit also eliminates a footgun: with the old logic, if some code
had tried to pass a state explicitly (presumably because the "inner"
state of the call was obsolete) but that "new" state happened to be
`nullptr`, then `invalidateRegions` would have silently used the inner
state attached to the call. However, I reviewed the call sites and don't
think that it was actually possible to reach this buggy execution path.1 parent df1d786 commit ca19ab9
File tree
3 files changed
+12
-16
lines changed- clang
- include/clang/StaticAnalyzer/Core/PathSensitive
- lib/StaticAnalyzer/Core
3 files changed
+12
-16
lines changedLines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 375 | + | |
| 376 | + | |
379 | 377 | | |
380 | | - | |
| 378 | + | |
381 | 379 | | |
382 | 380 | | |
383 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
| 233 | + | |
236 | 234 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
240 | 238 | | |
241 | 239 | | |
242 | 240 | | |
| |||
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
285 | 283 | | |
286 | 284 | | |
287 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
1016 | | - | |
| 1016 | + | |
1017 | 1017 | | |
1018 | 1018 | | |
1019 | 1019 | | |
| |||
0 commit comments