aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCCodeView.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-06-22 12:54:19 -0700
committerGitHub <noreply@github.com>2024-06-22 12:54:19 -0700
commit8cb6e587fd40b97983e445ee3f17f4c6d7190df7 (patch)
tree35295dce69e18c5300cdc3d8ced34a34e61ee481 /llvm/lib/MC/MCCodeView.cpp
parentfc23564c44f3eff1847462253d43c08b85489148 (diff)
downloadllvm-8cb6e587fd40b97983e445ee3f17f4c6d7190df7.zip
llvm-8cb6e587fd40b97983e445ee3f17f4c6d7190df7.tar.gz
llvm-8cb6e587fd40b97983e445ee3f17f4c6d7190df7.tar.bz2
[MC] Allocate MCFragment with a bump allocator
#95197 and 75006466296ed4b0f845cbbec4bf77c21de43b40 eliminated all raw `new MCXXXFragment`. We can now place fragments in a bump allocator. In addition, remove the dead `Kind == FragmentType(~0)` condition. ~CodeViewContext may call `StrTabFragment->destroy()` and need to be reset before `FragmentAllocator.Reset()`. Tested by llvm/test/MC/COFF/cv-compiler-info.ll using asan. Pull Request: https://github.com/llvm/llvm-project/pull/96402
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r--llvm/lib/MC/MCCodeView.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 713ae07..89b28b4 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -29,8 +29,8 @@ using namespace llvm::codeview;
CodeViewContext::~CodeViewContext() {
// If someone inserted strings into the string table but never actually
// emitted them somewhere, clean up the fragment.
- if (!InsertedStrTabFragment)
- delete StrTabFragment;
+ if (!InsertedStrTabFragment && StrTabFragment)
+ StrTabFragment->destroy();
}
/// This is a valid number for use with .cv_loc if we've already seen a .cv_file