]> granicus.if.org Git - clang/commitdiff
Added node cleanup to dstor of ExplodedGraph.
authorTed Kremenek <kremenek@apple.com>
Sun, 13 Jan 2008 05:03:01 +0000 (05:03 +0000)
committerTed Kremenek <kremenek@apple.com>
Sun, 13 Jan 2008 05:03:01 +0000 (05:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45929 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ExplodedGraph.h

index fbd0a24415f057c3ba4b3bc1831653252f431baa..347c9e6f4f9225ee90d452caecb152ba2d762bb4 100644 (file)
@@ -23,7 +23,6 @@
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/DepthFirstIterator.h"
-#include <vector>
 
 namespace clang {
 
@@ -159,7 +158,7 @@ protected:
   friend class GREngineImpl;
   
   // Type definitions.
-  typedef llvm::DenseMap<ProgramPoint,void*>         EdgeNodeSetMap;
+  typedef llvm::DenseMap<ProgramPoint,void*>        EdgeNodeSetMap;
   typedef llvm::SmallVector<ExplodedNodeImpl*,2>    RootsTy;
   typedef llvm::SmallVector<ExplodedNodeImpl*,10>   EndNodesTy;
   
@@ -204,7 +203,7 @@ protected:
   }
 
 public:
-  virtual ~ExplodedGraphImpl() {};
+  virtual ~ExplodedGraphImpl();
 
   unsigned num_roots() const { return Roots.size(); }
   unsigned num_eops() const { return EndNodes.size(); }
@@ -232,8 +231,16 @@ public:
     // 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)
-      delete reinterpret_cast<llvm::FoldingSet<NodeTy>*>(I->second);
+    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