summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-20 01:18:32 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-20 01:18:32 +0000
commit408f5a25fa762c5094895bcd5019e481fcd8905f (patch)
tree87783fdc002be6c377717e435783eae6ba4c9979 /llvm/lib
parentdb6bc8bfdf1a8ae412667d9c96883545ddc02800 (diff)
downloadbcm5719-llvm-408f5a25fa762c5094895bcd5019e481fcd8905f.tar.gz
bcm5719-llvm-408f5a25fa762c5094895bcd5019e481fcd8905f.zip
IR: Delete GenericDwarfNode during teardown
Fix a leak in `LLVMContextImpl` teardown that the leak sanitizer tracked down [1]. I've just switched to automatic dispatch here (since I'll inevitably forget again with the next class). [1]: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/811/steps/check-llvm%20asan/logs/stdio llvm-svn: 226536
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 81ff9a96f49..aa7242af997 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -78,10 +78,10 @@ LLVMContextImpl::~LLVMContextImpl() {
// unnecessary RAUW when nodes are still unresolved.
for (auto *I : DistinctMDNodes)
I->dropAllReferences();
- for (auto *I : MDTuples)
- I->dropAllReferences();
- for (auto *I : MDLocations)
+#define HANDLE_MDNODE_LEAF(CLASS) \
+ for (auto *I : CLASS##s) \
I->dropAllReferences();
+#include "llvm/IR/Metadata.def"
// Also drop references that come from the Value bridges.
for (auto &Pair : ValuesAsMetadata)
@@ -92,10 +92,10 @@ LLVMContextImpl::~LLVMContextImpl() {
// Destroy MDNodes.
for (MDNode *I : DistinctMDNodes)
I->deleteAsSubclass();
- for (MDTuple *I : MDTuples)
- delete I;
- for (MDLocation *I : MDLocations)
+#define HANDLE_MDNODE_LEAF(CLASS) \
+ for (CLASS *I : CLASS##s) \
delete I;
+#include "llvm/IR/Metadata.def"
// Free the constants. This is important to do here to ensure that they are
// freed before the LeakDetector is torn down.
OpenPOWER on IntegriCloud