Moved destructor logic of templated class ExplodedGraph to non-templated
parent class ExplodedGraphImpl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45930 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/ExplodedGraph.cpp b/Analysis/ExplodedGraph.cpp
index 4c9f026..61548e9 100644
--- a/Analysis/ExplodedGraph.cpp
+++ b/Analysis/ExplodedGraph.cpp
@@ -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;
+ }
+}