This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer] Iterator Checker - Part 7: Support for push and pop operations
ClosedPublic

Authored by baloghadamsoftware on May 5 2017, 5:29 AM.

Details

Summary

This patch adds support for the following operations in the iterator checkers: push_back, push_front, emplace_back, emplace_front, pop_back and pop_front. This affects iterator range checks (range is extended after push and emplace and reduced after pop operations) and invalidation checks (according to the standard).

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ accepted this revision.Dec 14 2017, 4:02 PM

This looks clear to me.

lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
1449–1464 ↗(On Diff #97942)

Would getDynamicTypeInfo() be of any help?

This revision is now accepted and ready to land.Dec 14 2017, 4:02 PM

Rebased to Part6. Also fixed a test failing now: it is not enough to mark the symbolic expressions as live, but if it is a SymIntExpr (it can be nothing else, except SymbolConjured), we also have to mark the left side of it (which is always SymbolConjured) as live. Using scanReachableSymbols() here would be too heavyweight.

baloghadamsoftware edited reviewers, added: dcoughlin; removed: zaks.anna.Apr 27 2018, 7:14 AM
NoQ added inline comments.Aug 16 2018, 2:51 PM
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
1477–1530 ↗(On Diff #144330)

I guess we should think if we want to use CallDescription for these when D48027 lands.

Updated according to the comments and rebased.

baloghadamsoftware marked an inline comment as done.Sep 5 2018, 2:07 AM
baloghadamsoftware added inline comments.
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
1477–1530 ↗(On Diff #144330)

Here we do not need the qualified name.

1449–1464 ↗(On Diff #97942)

I changed the function to use getDynamicTypeInfo(), but now I had to include a ProgramStateRef parameter to the function and to all its callers so it did not become much more simple.

This revision was automatically updated to reflect the committed changes.
baloghadamsoftware marked an inline comment as done.