summaryrefslogtreecommitdiff
path: root/lib/VMCore/LLVMContextImpl.h
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-02-18 20:53:16 +0000
committerDevang Patel <dpatel@apple.com>2010-02-18 20:53:16 +0000
commit06fdaccc89d9abdc7e03797b25173791a2f5692f (patch)
tree15113442c68dcae0c3957b9e1755bfbad7769f31 /lib/VMCore/LLVMContextImpl.h
parent16c1e79cb2b0b203aa76da4c90c16d9fd096762f (diff)
downloadllvm-06fdaccc89d9abdc7e03797b25173791a2f5692f.tar.gz
llvm-06fdaccc89d9abdc7e03797b25173791a2f5692f.tar.bz2
llvm-06fdaccc89d9abdc7e03797b25173791a2f5692f.tar.xz
Destroy MDNodes gracefully while deleting llvm context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/LLVMContextImpl.h')
-rw-r--r--lib/VMCore/LLVMContextImpl.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h
index 62491d838f..85bbe4ac9b 100644
--- a/lib/VMCore/LLVMContextImpl.h
+++ b/lib/VMCore/LLVMContextImpl.h
@@ -229,13 +229,23 @@ public:
if (I->second->use_empty())
delete I->second;
}
- MDNodeSet.clear();
AlwaysOpaqueTy->dropRef();
for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();
I != E; ++I) {
(*I)->AbstractTypeUsers.clear();
delete *I;
}
+ // Destroy MDNode operands first.
+ for (FoldingSetIterator<MDNode> I = MDNodeSet.begin(), E = MDNodeSet.end();
+ I != E;) {
+ MDNode *N = &(*I);
+ ++I;
+ N->replaceAllOperandsWithNull();
+ }
+ while (!MDNodeSet.empty()) {
+ MDNode *N = &(*MDNodeSet.begin());
+ N->destroy();
+ }
}
};