mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 16:37:42 +00:00
Move MCSection destruction to MCContext::reset.
Fixes the leaks when running llc. Also found by an asan bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1826cd69f3
commit
eac71e23fd
@ -55,14 +55,6 @@ MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
|
||||
}
|
||||
|
||||
MCContext::~MCContext() {
|
||||
// Call the destructors so the fragments are freed
|
||||
for (auto &I : ELFUniquingMap)
|
||||
I.second->~MCSectionELF();
|
||||
for (auto &I : COFFUniquingMap)
|
||||
I.second->~MCSectionCOFF();
|
||||
for (auto &I : MachOUniquingMap)
|
||||
I.second->~MCSectionMachO();
|
||||
|
||||
if (AutoReset)
|
||||
reset();
|
||||
|
||||
@ -78,6 +70,14 @@ MCContext::~MCContext() {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void MCContext::reset() {
|
||||
// Call the destructors so the fragments are freed
|
||||
for (auto &I : ELFUniquingMap)
|
||||
I.second->~MCSectionELF();
|
||||
for (auto &I : COFFUniquingMap)
|
||||
I.second->~MCSectionCOFF();
|
||||
for (auto &I : MachOUniquingMap)
|
||||
I.second->~MCSectionMachO();
|
||||
|
||||
UsedNames.clear();
|
||||
Symbols.clear();
|
||||
Allocator.Reset();
|
||||
|
Loading…
x
Reference in New Issue
Block a user