[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 12:49:05 PDT 2019
NoQ added a comment.
In D62525#1519475 <https://reviews.llvm.org/D62525#1519475>, @baloghadamsoftware wrote:
> Before someone asks: `NoteTag`s are not applicable here since invalidation and reaching one end of the range happens in many different places. This is also true for container emptiness.
Mm, what's wrong with many different places? If you're worried about code duplication, just put tag construction into a function (?)
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:281-282
+ // `FoundChange` becomes true when we find the statement the results in the
+ // current state of the iterator.
+ // `FoundEmptyness` becomes true when we find the block edge assuming
I don't think we should stop here. I think it's worth it to highlight *all* increments and decrements of the interesting iterator, so that it was clear how come that it has the given value.
Additionally, because iterators are copied around, it makes sense to "recursively" apply the visitor to the original object when the iterator is obtained as a copy (similarly to how `trackExpressionValue` works).
CHANGES SINCE LAST ACTION
More information about the cfe-commits