[PATCH] D82385: [Analyzer] Fix errors in iterator modeling

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 06:27:12 PDT 2020


baloghadamsoftware marked 2 inline comments as done.
baloghadamsoftware added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:530-532
   const auto *Pos = getIteratorPosition(State, LHS);
   if (!Pos)
     return;
----------------
Szelethus wrote:
> I fear this might be a stupid question, but what's up with `5 + it`? Why does the LHS have to be the iterator? Am I missing something here?
There is nothing wrong with it, but it is not (yet) supported, because I simply forgot. However I think it is much less common than `it + 5`. This patch is just a fixit patch, so I try not to add new features here, just fix existing ones.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:541
 
   auto &TgtVal = (Op == OO_PlusEqual || Op == OO_MinusEqual) ? LHS : RetVal;
 
----------------
Szelethus wrote:
> What does `Tgt` mean?
`Tgt` is the abbreviation of "target". The target of `+` and `-` is their results, but of `+=` and `-=` is their left operands. However, I did not change this line in this patch.


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

https://reviews.llvm.org/D82385





More information about the cfe-commits mailing list