[cfe-commits] r47923 - in /cfe/trunk: Analysis/GRExprEngine.cpp Analysis/GRSimpleVals.cpp Analysis/GRSimpleVals.h include/clang/Analysis/PathSensitive/ExplodedGraph.h include/clang/Analysis/PathSensitive/GRCoreEngine.h include/clang/Analysis/PathSensitive/GRExprEngine.h include/clang/Analysis/PathSensitive/GRTransferFuncs.h

Ted Kremenek kremenek at apple.com
Tue Mar 4 16:33:14 PST 2008


Author: kremenek
Date: Tue Mar  4 18:33:14 2008
New Revision: 47923

URL: http://llvm.org/viewvc/llvm-project?rev=47923&view=rev
Log:
Plug-in transfer function "EvalCall" now takes as an argument the current
GRStmtNodeBuilder and is now responsible for adding its own nodes to the graph.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp
    cfe/trunk/Analysis/GRSimpleVals.cpp
    cfe/trunk/Analysis/GRSimpleVals.h
    cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
    cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h
    cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
    cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Mar  4 18:33:14 2008
@@ -549,7 +549,13 @@
         continue;        
       
       // Dispatch to the plug-in transfer function.      
-      St = EvalCall(CE, cast<LVal>(L), (*DI)->getState());
+      
+      unsigned size = Dst.size();
+      
+      EvalCall(Dst, CE, cast<LVal>(L), *DI);
+      
+      if (Dst.size() == size)
+        Nodify(Dst, CE, *DI, St);
     }
     
     // Check for the "noreturn" attribute.

Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Tue Mar  4 18:33:14 2008
@@ -397,9 +397,14 @@
 // Transfer function for Function Calls.
 //===----------------------------------------------------------------------===//
 
-ValueState*
-GRSimpleVals::EvalCall(ValueStateManager& StateMgr, ValueManager& ValMgr,
-                       CallExpr* CE, LVal L, ValueState* St) {
+void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst,
+                            ValueStateManager& StateMgr,
+                            GRStmtNodeBuilder<ValueState>& Builder,
+                            ValueManager& ValMgr,
+                            CallExpr* CE, LVal L,
+                            ExplodedNode<ValueState>* Pred) {
+  
+  ValueState* St = Pred->getState();
   
   // Invalidate all arguments passed in by reference (LVals).
 
@@ -411,6 +416,6 @@
     if (isa<LVal>(V))
       St = StateMgr.SetRVal(St, cast<LVal>(V), UnknownVal());
   }
-  
-  return St;
+    
+  Builder.Nodify(Dst, CE, Pred, St);
 }

Modified: cfe/trunk/Analysis/GRSimpleVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.h?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.h (original)
+++ cfe/trunk/Analysis/GRSimpleVals.h Tue Mar  4 18:33:14 2008
@@ -52,10 +52,12 @@
   
   // Calls.
   
-  virtual ValueState* EvalCall(ValueStateManager& StateMgr,
-                               ValueManager& ValMgr,
-                               CallExpr* CE, LVal L,
-                               ValueState* St);
+  virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
+                        ValueStateManager& StateMgr,
+                        GRStmtNodeBuilder<ValueState>& Builder,
+                        ValueManager& ValMgr,
+                        CallExpr* CE, LVal L,
+                        ExplodedNode<ValueState>* Pred);
   
 protected:
   

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Tue Mar  4 18:33:14 2008
@@ -365,9 +365,10 @@
 };
   
   
-template <typename NodeTy>
+template <typename StateTy>
 class ExplodedNodeSet {
   
+  typedef ExplodedNode<StateTy>        NodeTy;
   typedef llvm::SmallPtrSet<NodeTy*,5> ImplTy;
   ImplTy Impl;
   

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h Tue Mar  4 18:33:14 2008
@@ -176,7 +176,7 @@
     return static_cast<NodeTy*>(NB.generateNodeImpl(S, St));    
   }
   
-  NodeTy* Nodify(ExplodedNodeSet<NodeTy>& Dst, Stmt* S,
+  NodeTy* Nodify(ExplodedNodeSet<StateTy>& Dst, Stmt* S,
                  NodeTy* Pred, StateTy* St) {
     
     // If the state hasn't changed, don't generate a new node.

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Tue Mar  4 18:33:14 2008
@@ -31,7 +31,7 @@
   typedef GRBranchNodeBuilder<GRExprEngine>        BranchNodeBuilder;
   typedef GRIndirectGotoNodeBuilder<GRExprEngine>  IndirectGotoNodeBuilder;
   typedef GRSwitchNodeBuilder<GRExprEngine>        SwitchNodeBuilder;
-  typedef ExplodedNodeSet<NodeTy>                  NodeSet;
+  typedef ExplodedNodeSet<StateTy>                 NodeSet;
     
 protected:
   /// G - the simulation graph.
@@ -414,8 +414,9 @@
     return TF->EvalBinOp(ValMgr, Op, cast<NonLVal>(L), cast<NonLVal>(R));
   }
   
-  ValueState* EvalCall(CallExpr* CE, LVal L, ValueState* St) {
-    return TF->EvalCall(StateMgr, ValMgr, CE, L, St);
+  void EvalCall(NodeSet& Dst, CallExpr* CE, LVal L, NodeTy* Pred) {
+    assert (Builder && "GRStmtNodeBuilder must be defined.");    
+    return TF->EvalCall(Dst, StateMgr, *Builder, ValMgr, CE, L, Pred);
   }
   
   ValueState* MarkBranch(ValueState* St, Stmt* Terminator, bool branchTaken);

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h?rev=47923&r1=47922&r2=47923&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h Tue Mar  4 18:33:14 2008
@@ -54,9 +54,11 @@
   
   // Calls.
   
-  virtual ValueState* EvalCall(ValueStateManager& StateMgr,
-                               ValueManager& ValMgr, CallExpr* CE, LVal L,
-                               ValueState* St) = 0;
+  virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
+                        ValueStateManager& StateMgr,
+                        GRStmtNodeBuilder<ValueState>& Builder,
+                        ValueManager& ValMgr, CallExpr* CE, LVal L,
+                        ExplodedNode<ValueState>* Pred) = 0;
 };
   
 } // end clang namespace





More information about the cfe-commits mailing list