[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 10:51:44 PDT 2020


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added a comment.

In D77229#1969524 <https://reviews.llvm.org/D77229#1969524>, @NoQ wrote:

> In D77229#1969455 <https://reviews.llvm.org/D77229#1969455>, @baloghadamsoftware wrote:
>
> > The problem is that the `CFGElement` for function `iterator begin() { return iterator(_start); }` is just a `CFGStmt` and not `CFGCXXRecordTypedCall`.
>
>
> In which code? It's not about the function, it's about the caller context.


In the very first test of `container_modeling.cpp`:

  void begin(const std::vector<int> &V) {
    V.begin();
  
    clang_analyzer_denote(clang_analyzer_container_begin(V), "$V.begin()");
    clang_analyzer_express(clang_analyzer_container_begin(V)); // expected-warning{{$V.begin()}}
                                                               // expected-note at -1{{$V.begin()}}
  }



================
Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:231-235
+        if (dyn_cast_or_null<InitListExpr>(LCtx->getParentMap().getParent(E))) {
+          MemRegionManager &MRMgr = getSValBuilder().getRegionManager();
+          return std::make_pair(
+              State, loc::MemRegionVal(MRMgr.getCXXTempObjectRegion(E, LCtx)));
+        }
----------------
NoQ wrote:
> baloghadamsoftware wrote:
> > baloghadamsoftware wrote:
> > > NoQ wrote:
> > > > baloghadamsoftware wrote:
> > > > > Did you mean this piece of code? It returns `&temp_object{struct simple_iterator_base, S44016}`. Is this correct? If so, I will factor out this code and put it into a common function to be used by both this function and the original one.
> > > > No, this one's for members, we've been talking about base classes.
> > > Oh yes, I see it now. But which one then? Maybe line 585? Or the whole `switch` expression? Sorry, I am not sure I fully understand this piece of code.
> > Now it returns `&Base{SymRegion{reg_$0<struct simple_derived_iterator * this>},simple_iterator_base}`. Is it correct?
> I don't know. What code are you analyzing in this thread of discussion?
Lines 1778-1813 of `iterator-modeling.cpp`. The only one test not commented out.


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

https://reviews.llvm.org/D77229





More information about the cfe-commits mailing list