[cfe-commits] r97129 - in /cfe/trunk: include/clang/Checker/PathSensitive/GRCoreEngine.h lib/Checker/CallInliner.cpp lib/Checker/GRCoreEngine.cpp lib/Checker/GRExprEngine.cpp

Zhongxing Xu xuzhongxing at gmail.com
Wed Feb 24 23:36:34 PST 2010


Author: zhongxingxu
Date: Thu Feb 25 01:36:34 2010
New Revision: 97129

URL: http://llvm.org/viewvc/llvm-project?rev=97129&view=rev
Log:
Move the dead bindings removal logic from CallInliner to GRExprEngine::ProcessCallExit().

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
    cfe/trunk/lib/Checker/CallInliner.cpp
    cfe/trunk/lib/Checker/GRCoreEngine.cpp
    cfe/trunk/lib/Checker/GRExprEngine.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h?rev=97129&r1=97128&r2=97129&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h Thu Feb 25 01:36:34 2010
@@ -502,7 +502,11 @@
   GRCallExitNodeBuilder(GRCoreEngine &eng, const ExplodedNode *pred)
     : Eng(eng), Pred(pred) {}
 
-  void GenerateNode();
+  const ExplodedNode *getPredecessor() const { return Pred; }
+
+  const GRState *getState() const { return Pred->getState(); }
+
+  void GenerateNode(const GRState *state);
 }; 
 } // end clang namespace
 

Modified: cfe/trunk/lib/Checker/CallInliner.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CallInliner.cpp?rev=97129&r1=97128&r2=97129&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CallInliner.cpp (original)
+++ cfe/trunk/lib/Checker/CallInliner.cpp Thu Feb 25 01:36:34 2010
@@ -60,20 +60,10 @@
   ExplodedNode *Pred = B.getPredecessor();
 
   const StackFrameContext *LocCtx = 
-                         cast<StackFrameContext>(Pred->getLocationContext());
+                        cast<StackFrameContext>(Pred->getLocationContext());
   // Check if this is the top level stack frame.
   if (!LocCtx->getParent())
-    return;
-
-  const StackFrameContext *ParentSF = 
-                                   cast<StackFrameContext>(LocCtx->getParent());
-
-  SymbolReaper SymReaper(*ParentSF->getLiveVariables(), Eng.getSymbolManager(), 
-                         ParentSF);
-  const Stmt *CE = LocCtx->getCallSite();
-  // FIXME: move this logic to GRExprEngine::ProcessCallExit().
-  state = Eng.getStateManager().RemoveDeadBindings(state, const_cast<Stmt*>(CE),
-                                                   SymReaper);
+   return;
 
   B.GenerateCallExitNode(state);
 }

Modified: cfe/trunk/lib/Checker/GRCoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRCoreEngine.cpp?rev=97129&r1=97128&r2=97129&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRCoreEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRCoreEngine.cpp Thu Feb 25 01:36:34 2010
@@ -674,14 +674,14 @@
     Eng.WList->Enqueue(Node);
 }
 
-void GRCallExitNodeBuilder::GenerateNode() {
+void GRCallExitNodeBuilder::GenerateNode(const GRState *state) {
   // Get the callee's location context.
   const StackFrameContext *LocCtx 
                          = cast<StackFrameContext>(Pred->getLocationContext());
 
   PostStmt Loc(LocCtx->getCallSite(), LocCtx->getParent());
   bool isNew;
-  ExplodedNode *Node = Eng.G->getNode(Loc, Pred->getState(), &isNew);
+  ExplodedNode *Node = Eng.G->getNode(Loc, state, &isNew);
   Node->addPredecessor(const_cast<ExplodedNode*>(Pred), *Eng.G);
   if (isNew)
     Eng.WList->Enqueue(Node, *const_cast<CFGBlock*>(LocCtx->getCallSiteBlock()),

Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=97129&r1=97128&r2=97129&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Thu Feb 25 01:36:34 2010
@@ -1305,7 +1305,21 @@
 }
 
 void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
-  B.GenerateNode();
+  const GRState *state = B.getState();
+  const ExplodedNode *Pred = B.getPredecessor();
+  const StackFrameContext *LocCtx = 
+                            cast<StackFrameContext>(Pred->getLocationContext());
+  const StackFrameContext *ParentSF = 
+                            cast<StackFrameContext>(LocCtx->getParent());
+
+  SymbolReaper SymReaper(*ParentSF->getLiveVariables(), getSymbolManager(),
+                         ParentSF);
+  const Stmt *CE = LocCtx->getCallSite();
+
+  state = getStateManager().RemoveDeadBindings(state, const_cast<Stmt*>(CE),
+                                               SymReaper);
+  
+  B.GenerateNode(state);
 }
 
 //===----------------------------------------------------------------------===//





More information about the cfe-commits mailing list