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
- 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
Event Timeline
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.
Updated according to the comments and assertions added to fail the tests without the fix.
Looks good with minor comments.
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp | ||
---|---|---|
493 | Let's only mark SymbolData-type symbols as live; that should be enough. | |
1168 | Typo: "be". | |
1170–1177 | 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 | Also typo. |
Let's only mark SymbolData-type symbols as live; that should be enough.