[PATCH] D62926: [analyzer] ReturnVisitor: Bypass constructing objects to see inlined calls

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 04:18:24 PDT 2019


Charusso marked an inline comment as done.
Charusso added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:835-842
     // First, find when we processed the statement.
     do {
       if (auto CEE = Node->getLocationAs<CallExitEnd>())
         if (CEE->getCalleeContext()->getCallSite() == S)
           break;
-      if (auto SP = Node->getLocationAs<StmtPoint>())
-        if (SP->getStmt() == S)
-          break;
 
       Node = Node->getFirstPred();
----------------
Charusso wrote:
> NoQ wrote:
> > This iteration may now take us straight to the root of the graph. I don't think it's supposed to be that slow; i think it's supposed to only skip within maybe a full-expression at most.
> > 
> > Which statements in the AST are getting peeled off here that weren't before? Which statements are supposed to get peeled off?
> > 
> > Might it be that we should simply add one more case to `peelOffOuterExpr()` or something like that?
> We have the following sequence in the loop:
> 
> ```
> "stmt_kind": "DeclStmt", "stmt_point_kind": "PostStmt"
> "stmt_kind": "DeclStmt", "stmt_point_kind": "PostStore"
> "stmt_kind": "DeclStmt",  "stmt_point_kind": "PreStmtPurgeDeadSymbols"
> "pretty": "S *s = new S [10];"
> 
> "stmt_kind": "CXXNewExpr", "stmt_point_kind": "PostStmt"
> "stmt_kind": "CXXNewExpr", "stmt_point_kind": "PreStmtPurgeDeadSymbols"
> "pretty": "new S [10]"
> 
> "stmt_kind": "CXXConstructExpr", "stmt_point_kind": "PostStmt"
> "stmt_kind": "CXXConstructExpr", "stmt_point_kind": "PreStmt"
> "stmt_kind": "CXXConstructExpr", "stmt_point_kind": "PreStmtPurgeDeadSymbols"
> "pretty": null
> 
> "kind": "CallExitEnd" - found the ReturnStmt, all good.
> ```
> 
> This ReturnVisitor is totally ProgramPoint-based and I wanted to be super generic. Do you know about more problematic constructing-object?
Btw: this cool dump based on D62946


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

https://reviews.llvm.org/D62926





More information about the cfe-commits mailing list