[PATCH] D74541: [Analyzer] Use note tags to track iterator increments and decrements

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 07:57:40 PDT 2020


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.
Herald added a subscriber: DenisDvlp.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:489-490
+    StringRef ChangeText =
+      ((Op == OO_Plus || Op == OO_PlusEqual) != (ChangeVal <= 0)) ?
+      "incremented" : "decremented";
+    const NoteTag *ChangeTag = getChangeTag(C, ChangeText, ItE,
----------------
NoQ wrote:
> NoQ wrote:
> > Can we assert out the `ChangeVal == 0` case or make a better message for it (`"unchanged"` or something like that)?
> Another important thing to do here is to track the RHS value via `trackExpressionValue()`. I.e., why do we think that iterator is incremented by 1 and not by 2?
I agree, that is important, but where should I call it? This is the modeling checker, which models the increments and the decrements, but `trackExpressionValue()` can only be invoked for bug reports. Should I put it into the `NoteTag` lambda?


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

https://reviews.llvm.org/D74541





More information about the cfe-commits mailing list