[PATCH] D47417: [analyzer] Add missing state transition in IteratorChecker

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 27 23:10:50 PDT 2018

NoQ added a comment.

Nice catch!

Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:399
+  C.addTransition(State);
MTC wrote:
> I have two questions may need @NoQ or @xazax.hun who is more familiar with the analyzer engine help to answer.
>   - `State` may not change at all, do we need a check here like [[ https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp#L227 | if (state != originalState) ]]
>   - A more basic problem is that do we need `originalState = State` trick. It seems that `addTransitionImpl()` has a check about same state transition, see [[ https://github.com/llvm-mirror/clang/blob/master/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h#L339 | addTransitionImp() ]].
> Thanks in advance!
> It seems that `addTransitionImpl()` has a check about same state transition, see `addTransitionImp()`.

Yep, you pretty much answered your question. The check in the checker code is unnecessary.

  rC Clang


More information about the cfe-commits mailing list