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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 15 20:57:03 PDT 2020


NoQ added inline comments.


================
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:
> 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?


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

https://reviews.llvm.org/D74541





More information about the cfe-commits mailing list