]> granicus.if.org Git - clang/commitdiff
Added more boilerplate for processing end-of-paths.
authorTed Kremenek <kremenek@apple.com>
Mon, 7 Jan 2008 22:22:13 +0000 (22:22 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 7 Jan 2008 22:22:13 +0000 (22:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45724 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/ReachabilityEngine.cpp
include/clang/Analysis/PathSensitive/ReachabilityEngine.h

index 02804b10dd2b4df9368e09b942681f6f9ba01b96..679be51351e87527803eaf8016a3bed9f487875e 100644 (file)
@@ -130,7 +130,11 @@ void ReachabilityEngineImpl::ProcessBlkBlk(const BlkBlkEdge& E,
   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;
   }
   
index d53c7f102f1b96ffdadee8f06483c08ee5f142bf..d4b5f38da98f1b03bc9b6f1e6a7466bff60dfb26 100644 (file)
@@ -102,7 +102,7 @@ protected:
   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 @@ protected:
     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 @@ public:
   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()); }
+  /// getGraph - Returns the exploded graph.
+  GraphTy& getGraph() { 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();
+  /// 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