Marking a symbolic expression as live is not recursive. In our checkers we either use conjured symbols or conjured symbols plus/minus concrete integers to represent abstract positions of iterators, so we must mark the left-hand side of these expressions as live to prevent them from getting reaped.
Details
Details
- Reviewers
NoQ mikhail.ramalho george.karpenkov - Commits
- rG0a7592b5e248: [Analyzer] Mark `SymbolData` parts of iterator position as live in program…
rC337151: [Analyzer] Mark `SymbolData` parts of iterator position as live in program…
rL337151: [Analyzer] Mark `SymbolData` parts of iterator position as live in program…
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
That's right. You only need to mark "atomic" symbols (SymbolData) as live, and expressions that contain them would automatically become live. So i think you should just iterate through a symbol_iterator and mark all SymbolData symbols you encounter as live.
Is this a hotfix for a test failure? Otherwise it'd be great to have tests.
Comment Actions
Updated according to the comments and assertions added to fail the tests without the fix.
Comment Actions
Looks good with minor comments.
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp | ||
---|---|---|
493 ↗ | (On Diff #153698) | Let's only mark SymbolData-type symbols as live; that should be enough. |
1168 ↗ | (On Diff #153698) | Typo: "be". |
1170–1177 ↗ | (On Diff #153698) | I believe this code should be reworked as follows:
This should hopefully yield the same result without ever needing to introspect the SymExpr. I suggest a FIXME. |
1237 ↗ | (On Diff #153698) | Also typo. |