mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
022707e65a
commit
47ddb76984
@ -78,10 +78,10 @@ LLVMContextImpl::~LLVMContextImpl() {
|
|||||||
// unnecessary RAUW when nodes are still unresolved.
|
// unnecessary RAUW when nodes are still unresolved.
|
||||||
for (auto *I : DistinctMDNodes)
|
for (auto *I : DistinctMDNodes)
|
||||||
I->dropAllReferences();
|
I->dropAllReferences();
|
||||||
for (auto *I : MDTuples)
|
#define HANDLE_MDNODE_LEAF(CLASS) \
|
||||||
I->dropAllReferences();
|
for (auto *I : CLASS##s) \
|
||||||
for (auto *I : MDLocations)
|
|
||||||
I->dropAllReferences();
|
I->dropAllReferences();
|
||||||
|
#include "llvm/IR/Metadata.def"
|
||||||
|
|
||||||
// Also drop references that come from the Value bridges.
|
// Also drop references that come from the Value bridges.
|
||||||
for (auto &Pair : ValuesAsMetadata)
|
for (auto &Pair : ValuesAsMetadata)
|
||||||
@ -92,10 +92,10 @@ LLVMContextImpl::~LLVMContextImpl() {
|
|||||||
// Destroy MDNodes.
|
// Destroy MDNodes.
|
||||||
for (MDNode *I : DistinctMDNodes)
|
for (MDNode *I : DistinctMDNodes)
|
||||||
I->deleteAsSubclass();
|
I->deleteAsSubclass();
|
||||||
for (MDTuple *I : MDTuples)
|
#define HANDLE_MDNODE_LEAF(CLASS) \
|
||||||
delete I;
|
for (CLASS *I : CLASS##s) \
|
||||||
for (MDLocation *I : MDLocations)
|
|
||||||
delete I;
|
delete I;
|
||||||
|
#include "llvm/IR/Metadata.def"
|
||||||
|
|
||||||
// Free the constants. This is important to do here to ensure that they are
|
// Free the constants. This is important to do here to ensure that they are
|
||||||
// freed before the LeakDetector is torn down.
|
// freed before the LeakDetector is torn down.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user