aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r--llvm/lib/MC/MCContext.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index bb87682..e7fc883 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -151,10 +151,15 @@ void MCContext::reset() {
SPIRVAllocator.DestroyAll();
WasmSignatureAllocator.DestroyAll();
+ // ~CodeViewContext may destroy a MCFragment outside of sections and need to
+ // be reset before FragmentAllocator.
+ CVContext.reset();
+
MCSubtargetAllocator.DestroyAll();
InlineAsmUsedLabelNames.clear();
Symbols.clear();
Allocator.Reset();
+ FragmentAllocator.Reset();
Instances.clear();
CompilationDir.clear();
MainFileName.clear();
@@ -165,8 +170,6 @@ void MCContext::reset() {
DwarfCompileUnitID = 0;
CurrentDwarfLoc = MCDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0);
- CVContext.reset();
-
MachOUniquingMap.clear();
ELFUniquingMap.clear();
GOFFUniquingMap.clear();