[PATCH] D75677: [Analyzer] Only add iterator note tags to the operations of the affected iterators

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 13 05:06:54 PDT 2020


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


================
Comment at: clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp:91-111
   SVal V = C.getSVal(CE->getArg(0));
   const auto *Pos = getIteratorPosition(State, V);
+  SVal Field = Default;
+
   if (Pos) {
-    State = State->BindExpr(CE, C.getLocationContext(), get(Pos));
-  } else {
-    State = State->BindExpr(CE, C.getLocationContext(), Default);
+    Field = get(Pos);
   }
----------------
Szelethus wrote:
> Now that we have multiple `SVal`s around, can we rename `V`? Also, I would appreciate some comments. As I understand it, `ExprInspectionChecker` now marks the arguments as interesting, so if we write this:
> ```lang=cpp
> clang_analyzer_express(clang_analyzer_iterator_position(i2));
> ```
> `clang_analyzer_iterator_position(i2)` will be interesting, and this function propagates this interestingness to `i2`, correct?
Yes.


================
Comment at: clang/test/Analysis/iterator-modelling.cpp:169
 
   clang_analyzer_eval(clang_analyzer_iterator_container(i2) == &v); // expected-warning{{TRUE}}
                                                                     // expected-note at -1{{TRUE}}
----------------
Szelethus wrote:
> Interestingness won't be propagated here because `clang_analyzer_iterator_container(i2) == &v` is interesting, not `clang_analyzer_iterator_container(i2)`, correct?
Currently only `clang_analyzer_express()` marks its argument as interesting. This could be extended in the future, however the argument of `clang_analyzer_eval()` is usually the result of the comparison, not the symbolic comparison itself so the sides of the comparison are not reachable at that point.


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

https://reviews.llvm.org/D75677





More information about the cfe-commits mailing list