From: Ted Kremenek Date: Sun, 13 Jan 2008 05:03:01 +0000 (+0000) Subject: Added node cleanup to dstor of ExplodedGraph. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90e2280fd242b02d9829365570ba3966217cb0e0;p=clang Added node cleanup to dstor of ExplodedGraph. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45929 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index fbd0a24415..347c9e6f4f 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -23,7 +23,6 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/DepthFirstIterator.h" -#include namespace clang { @@ -159,7 +158,7 @@ protected: friend class GREngineImpl; // Type definitions. - typedef llvm::DenseMap EdgeNodeSetMap; + typedef llvm::DenseMap EdgeNodeSetMap; typedef llvm::SmallVector RootsTy; typedef llvm::SmallVector 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*>(I->second); + for (EdgeNodeSetMap::iterator I=Nodes.begin(), E=Nodes.end(); I!=E; ++I) { + llvm::FoldingSet* ENodes = + reinterpret_cast*>(I->second); + + for (typename llvm::FoldingSet::iterator + I=ENodes->begin(), E=ENodes->end(); I!=E; ++I) + delete *I; + + delete ENodes; + } } /// getCheckerState - Returns the internal checker state associated