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

Henry Wong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 28 01:59:41 PDT 2018


MTC added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:399
+
+  C.addTransition(State);
 }
----------------
NoQ wrote:
> 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.
Thanks, NoQ! It seems that `if (state != originalState)` in some checkers is misleading and may need to be cleaned up.


Repository:
  rC Clang

https://reviews.llvm.org/D47417





More information about the cfe-commits mailing list