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

Ted Kremenek kremenek at apple.com
Sat Jan 12 21:33:04 PST 2008


Author: kremenek
Date: Sat Jan 12 23:33:04 2008
New Revision: 45930

URL: http://llvm.org/viewvc/llvm-project?rev=45930&view=rev
Log:
Moved destructor logic of templated class ExplodedGraph to non-templated
parent class ExplodedGraphImpl.

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

Modified: cfe/trunk/Analysis/ExplodedGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ExplodedGraph.cpp?rev=45930&r1=45929&r2=45930&view=diff

==============================================================================
--- cfe/trunk/Analysis/ExplodedGraph.cpp (original)
+++ cfe/trunk/Analysis/ExplodedGraph.cpp Sat Jan 12 23:33:04 2008
@@ -68,3 +68,20 @@
 ExplodedNodeImpl::NodeGroup::~NodeGroup() {
   if (getKind() == SizeOther) delete &getVector(getPtr());
 }
+
+
+ExplodedGraphImpl::~ExplodedGraphImpl() {
+  // Delete the FoldingSet's in Nodes.  Note that the contents
+  // of the FoldingSets are nodes allocated from the BumpPtrAllocator,
+  // so all of those will get nuked when that object is destroyed.
+  for (EdgeNodeSetMap::iterator I=Nodes.begin(), E=Nodes.end(); I!=E; ++I) {
+    llvm::FoldingSet<ExplodedNodeImpl>* ENodes = 
+      reinterpret_cast<llvm::FoldingSet<ExplodedNodeImpl>*>(I->second);
+    
+    for (llvm::FoldingSet<ExplodedNodeImpl>::iterator
+         I=ENodes->begin(), E=ENodes->end(); I!=E; ++I)
+      delete &*I;
+    
+    delete ENodes;
+  }
+}

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=45930&r1=45929&r2=45930&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Sat Jan 12 23:33:04 2008
@@ -86,6 +86,16 @@
   }
   
 public:
+  // This method is only defined so that we can cast a
+  // void* to FoldingSet<ExplodedNodeImpl> so that we can iterate
+  // over the vertices of EdgeNodeSetMap in ExplodeGraphImpl.
+  // The actual profiling of vertices will be done in the derived
+  // class, ExplodedNode<>.  Nodes will NEVER be INSERTED into the
+  // FoldingSet using this Profile method (since it doesn't do anything).
+  inline void Profile(llvm::FoldingSetNodeID& ID) const {
+    assert (false && "Needs to be implemented in derived class.");
+  }
+  
   /// getLocation - Returns the edge associated with the given node.
   const ProgramPoint& getLocation() const { return Location; }
   
@@ -227,22 +237,6 @@
   }
     
 public:
-  virtual ~ExplodedGraph() {
-    // Delete the FoldingSet's in Nodes.  Note that the contents
-    // of the FoldingSets are nodes allocated from the BumpPtrAllocator,
-    // so all of those will get nuked when that object is destroyed.
-    for (EdgeNodeSetMap::iterator I=Nodes.begin(), E=Nodes.end(); I!=E; ++I) {
-      llvm::FoldingSet<NodeTy>* ENodes = 
-        reinterpret_cast<llvm::FoldingSet<NodeTy>*>(I->second);
-      
-      for (typename llvm::FoldingSet<NodeTy>::iterator
-             I=ENodes->begin(), E=ENodes->end(); I!=E; ++I)
-        delete *I;
-      
-      delete ENodes;
-    }
-  }
-  
   /// getCheckerState - Returns the internal checker state associated
   ///  with the exploded graph.  Ownership remains with the ExplodedGraph
   ///  objecct.





More information about the cfe-commits mailing list