summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-20 00:47:34 +0000
committerChris Lattner <sabre@nondot.org>2010-04-20 00:47:34 +0000
commitaedb8a35355f451564975865694314ea20c8a37c (patch)
tree4a76b0a332a934e3d9ba7d7fa2ca70bd9b0d1ae8 /llvm/lib/Analysis/IPA/CallGraph.cpp
parenta5cdd5e6a2132897f8f8d32a13c97bd08764c55f (diff)
downloadbcm5719-llvm-aedb8a35355f451564975865694314ea20c8a37c.tar.gz
bcm5719-llvm-aedb8a35355f451564975865694314ea20c8a37c.zip
make CallGraphNode dtor abort if a node is deleted when there are still
references to it. llvm-svn: 101847
Diffstat (limited to 'llvm/lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/IPA/CallGraph.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp
index 8c43aa14885..c59c31c22a9 100644
--- a/llvm/lib/Analysis/IPA/CallGraph.cpp
+++ b/llvm/lib/Analysis/IPA/CallGraph.cpp
@@ -158,6 +158,7 @@ private:
// destroy - Release memory for the call graph
virtual void destroy() {
/// CallsExternalNode is not in the function map, delete it explicitly.
+ CallsExternalNode->allReferencesDropped();
delete CallsExternalNode;
CallsExternalNode = 0;
CallGraph::destroy();
@@ -181,6 +182,14 @@ void CallGraph::initialize(Module &M) {
void CallGraph::destroy() {
if (FunctionMap.empty()) return;
+ // Reset all node's use counts to zero before deleting them to prevent an
+ // assertion from firing.
+#ifndef NDEBUG
+ for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end();
+ I != E; ++I)
+ I->second->allReferencesDropped();
+#endif
+
for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end();
I != E; ++I)
delete I->second;
OpenPOWER on IntegriCloud