[PATCH] D62525: [Analyzer] Add new visitor to the iterator checkers

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 07:57:15 PDT 2019


baloghadamsoftware added a comment.

In D62525#1519868 <https://reviews.llvm.org/D62525#1519868>, @NoQ wrote:

> 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 (?)


It is not about code duplication. Of course, that can be handled by a function.

The problem is that the transition is added in the top level function but iterator position adjustments happen in the lower level ones. Data flow is one-way, top-down. For example, an insertion happens into a vector that invalidates all the iterators at and after the position where it is inserted. In this case `handleInsert()` calls a function that iterates all the active iterator positions and calls other one that invalidates the ones affected by the insertion. To propagate back the list of iterators invalidated would be too complex. Increments and decrements are even worse. Thus here the correct way seems to find the relevant transitions in a visitor instead of trying to figure out what note tags to add at each transition.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62525/new/

https://reviews.llvm.org/D62525





More information about the cfe-commits mailing list