[cfe-commits] r45724 - in /cfe/trunk: Analysis/ReachabilityEngine.cpp include/clang/Analysis/PathSensitive/ReachabilityEngine.h

Ted Kremenek kremenek at apple.com
Mon Jan 7 14:22:14 PST 2008


Author: kremenek
Date: Mon Jan  7 16:22:13 2008
New Revision: 45724

URL: http://llvm.org/viewvc/llvm-project?rev=45724&view=rev
Log:
Added more boilerplate for processing end-of-paths.

Modified:
    cfe/trunk/Analysis/ReachabilityEngine.cpp
    cfe/trunk/include/clang/Analysis/PathSensitive/ReachabilityEngine.h

Modified: cfe/trunk/Analysis/ReachabilityEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ReachabilityEngine.cpp?rev=45724&r1=45723&r2=45724&view=diff

==============================================================================
--- cfe/trunk/Analysis/ReachabilityEngine.cpp (original)
+++ cfe/trunk/Analysis/ReachabilityEngine.cpp Mon Jan  7 16:22:13 2008
@@ -130,7 +130,11 @@
   if (Blk == &cfg.getExit()) {
     assert (cfg.getExit().size() == 0 && "EXIT block cannot contain Stmts.");
     // Process the End-Of-Path.
-    ProcessEOP(Blk, Pred);
+    void* State = ProcessEOP(Blk, Pred->State);
+    bool IsNew;
+    ExplodedNodeImpl* V = G->getNodeImpl(BlkStmtEdge(Blk,NULL),State,&IsNew);
+    V->addUntypedPredecessor(Pred);
+    if (IsNew) G->addEndOfPath(V);
     return;
   }
   

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ReachabilityEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ReachabilityEngine.h Mon Jan  7 16:22:13 2008
@@ -102,7 +102,7 @@
   void ProcessBlkStmt(const BlkStmtEdge& E, ExplodedNodeImpl* Pred);
   void ProcessStmtBlk(const StmtBlkEdge& E, ExplodedNodeImpl* Pred);
 
-  virtual void ProcessEOP(CFGBlock* Blk, ExplodedNodeImpl* Pred);
+  virtual void* ProcessEOP(CFGBlock* Blk, void* State);
   virtual void ProcessStmt(Stmt* S, ExplodedNodeImpl* Pred);
   virtual void ProcessTerminator(Stmt* Terminator, ExplodedNodeImpl* Pred);
 
@@ -136,16 +136,10 @@
     return (void*) getCheckerState()->getInitialState();        
   }
   
-  virtual void ProcessEOP(CFGBlock* Blk, ExplodedNodeImpl* Pred) {
-    assert (false && "Not implemented yet.");
+  virtual void* ProcessEOP(CFGBlock* Blk, void* State) {
     // FIXME: Perform dispatch to adjust state.
-//    ExplodedNodeImpl* V = G->getNodeImpl(BlkStmtEdge(Blk,NULL),
-//                                         Pred->State).first;
-    
-//    V->addPredecessor(Pred);
-//    Graph.addEndOfPath(V);  
+    return State;
   }
-    
   
   virtual void ProcessStmt(Stmt* S, ExplodedNodeImpl* Pred) {
     CurrentBlkExpr = S;    
@@ -170,14 +164,12 @@
   ReachabilityEngine(CFG& cfg, reng::WorkList* wlist) 
     : ReachabilityEngineImpl(cfg,wlist) {}
   
-  /// getGraph - Returns the exploded graph.  Ownership of the graph remains
-  ///  with the ReachabilityEngine object.
-  GraphTy* getGraph() const { return static_cast<GraphTy*>(G.get()); }
-  
-  /// getCheckerState - Returns the internal checker state.  Ownership is not
-  ///  transferred to the caller.
-  CheckerTy* getCheckerState() const {
-    return static_cast<GraphTy*>(G.get())->getCheckerState();
+  /// getGraph - Returns the exploded graph.
+  GraphTy& getGraph() { return *static_cast<GraphTy*>(G.get()); }
+  
+  /// getCheckerState - Returns the internal checker state.
+  CheckerTy& getCheckerState() {
+    return *static_cast<GraphTy*>(G.get())->getCheckerState();
   }  
   
   /// takeGraph - Returns the exploded graph.  Ownership of the graph is





More information about the cfe-commits mailing list