[cfe-commits] r115120 - /cfe/trunk/lib/Checker/GRCXXExprEngine.cpp

Ted Kremenek kremenek at apple.com
Wed Sep 29 18:06:29 PDT 2010


Author: kremenek
Date: Wed Sep 29 20:06:29 2010
New Revision: 115120

URL: http://llvm.org/viewvc/llvm-project?rev=115120&view=rev
Log:
Include changes to VisitCXXMemberCallExpr (call visitor functions).

Modified:
    cfe/trunk/lib/Checker/GRCXXExprEngine.cpp

Modified: cfe/trunk/lib/Checker/GRCXXExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRCXXExprEngine.cpp?rev=115120&r1=115119&r2=115120&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRCXXExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRCXXExprEngine.cpp Wed Sep 29 20:06:29 2010
@@ -157,13 +157,21 @@
       VisitLValue(ObjArgExpr, *I, AllArgsEvaluated);
   }
 
+  // Allow checkers to pre-visit the member call.
+  ExplodedNodeSet PreVisitChecks;
+  CheckerVisit(MCE, PreVisitChecks, AllArgsEvaluated, PreVisitStmtCallback);
+
+  // Now evaluate the call itself.
   const CXXMethodDecl *MD = cast<CXXMethodDecl>(ME->getMemberDecl());
   assert(MD && "not a CXXMethodDecl?");
 
-  if (!(MD->isThisDeclarationADefinition() && AMgr.shouldInlineCall()))
+  if (!(MD->isThisDeclarationADefinition() && AMgr.shouldInlineCall())) {
     // FIXME: conservative method call evaluation.
+    CheckerVisit(MCE, Dst, PreVisitChecks, PostVisitStmtCallback);
     return;
+  }
 
+  ExplodedNodeSet SetupThis;
   const StackFrameContext *SFC = AMgr.getStackFrame(MD, 
                                                     Pred->getLocationContext(),
                                                     MCE, 
@@ -171,15 +179,20 @@
                                                     Builder->getIndex());
   const CXXThisRegion *ThisR = getCXXThisRegion(MD, SFC);
   CallEnter Loc(MCE, SFC->getAnalysisContext(), Pred->getLocationContext());
-  for (ExplodedNodeSet::iterator I = AllArgsEvaluated.begin(),
-         E = AllArgsEvaluated.end(); I != E; ++I) {
+  for (ExplodedNodeSet::iterator I = PreVisitChecks.begin(),
+         E = PreVisitChecks.end(); I != E; ++I) {
     // Set up 'this' region.
     const GRState *state = GetState(*I);
     state = state->bindLoc(loc::MemRegionVal(ThisR),state->getSVal(ObjArgExpr));
-    ExplodedNode *N = Builder->generateNode(Loc, state, *I);
-    if (N)
-      Dst.Add(N);
+    SetupThis.Add(Builder->generateNode(Loc, state, *I));
   }
+
+  // FIXME: Perform the actual method call.  Right now all we do is evaluate
+  // the arguments.
+
+  // Perform post-visit.
+  CheckerVisit(MCE, Dst, /* FIXME: don't forget to update later */ SetupThis,
+               PostVisitStmtCallback);
 }
 
 void GRExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,





More information about the cfe-commits mailing list