summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-13 05:33:04 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-13 05:33:04 +0000
commitd122bbdb0689fbea6910ef08b9383fcbecaf8a58 (patch)
tree008fc627465568a8656756ea8a69098e2f13a761 /clang
parent6d7aee6eddc6ddcd333cf5878985cdad73d63ec9 (diff)
downloadbcm5719-llvm-d122bbdb0689fbea6910ef08b9383fcbecaf8a58.tar.gz
bcm5719-llvm-d122bbdb0689fbea6910ef08b9383fcbecaf8a58.zip
Moved destructor logic of templated class ExplodedGraph to non-templated
parent class ExplodedGraphImpl. llvm-svn: 45930
Diffstat (limited to 'clang')
-rw-r--r--clang/Analysis/ExplodedGraph.cpp17
-rw-r--r--clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h26
2 files changed, 27 insertions, 16 deletions
diff --git a/clang/Analysis/ExplodedGraph.cpp b/clang/Analysis/ExplodedGraph.cpp
index 4c9f0265328..61548e9b274 100644
--- a/clang/Analysis/ExplodedGraph.cpp
+++ b/clang/Analysis/ExplodedGraph.cpp
@@ -68,3 +68,20 @@ ExplodedNodeImpl** ExplodedNodeImpl::NodeGroup::end() const {
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;
+ }
+}
diff --git a/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
index 347c9e6f4f9..1a9ec32f601 100644
--- a/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
+++ b/clang/include/clang/Analysis/PathSensitive/ExplodedGraph.h
@@ -86,6 +86,16 @@ protected:
}
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 @@ protected:
}
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.
OpenPOWER on IntegriCloud