aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCCodeView.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-07-20 12:00:43 -0700
committerFangrui Song <i@maskray.me>2025-07-20 12:00:43 -0700
commitdd50e8e240d19e5050f4e52d8715d093a3fb810a (patch)
tree4326665d6d99bea19f1b835c12eacbd776ab52bc /llvm/lib/MC/MCCodeView.cpp
parent04b4f62e2f91a66ad47276f6e344afd0be17a325 (diff)
downloadllvm-dd50e8e240d19e5050f4e52d8715d093a3fb810a.zip
llvm-dd50e8e240d19e5050f4e52d8715d093a3fb810a.tar.gz
llvm-dd50e8e240d19e5050f4e52d8715d093a3fb810a.tar.bz2
MCFragment: Remove setContents/setFixups
Make the fixed-size part of MCFragment append-only to support allocating content as trailing data. Update CodeView callers to use setVarContents instead of setContents. Remove unused setFixups.
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r--llvm/lib/MC/MCCodeView.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index b151a25..7d528a5 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -26,8 +26,10 @@ using namespace llvm;
using namespace llvm::codeview;
void CodeViewContext::finish() {
- if (StrTabFragment)
- StrTabFragment->setContents(StrTab);
+ if (!StrTabFragment)
+ return;
+ assert(StrTabFragment->getKind() == MCFragment::FT_Data);
+ StrTabFragment->setVarContents(StrTab);
}
/// This is a valid number for use with .cv_loc if we've already seen a .cv_file
@@ -168,6 +170,7 @@ void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
if (!StrTabFragment) {
OS.newFragment();
StrTabFragment = OS.getCurrentFragment();
+ OS.newFragment();
}
OS.emitValueToAlignment(Align(4), 0);
@@ -603,7 +606,7 @@ void CodeViewContext::encodeInlineLineTable(const MCAssembler &Asm,
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer);
- Frag.setContents(Buffer);
+ Frag.setVarContents(Buffer);
}
void CodeViewContext::encodeDefRange(const MCAssembler &Asm,
@@ -691,6 +694,6 @@ void CodeViewContext::encodeDefRange(const MCAssembler &Asm,
}
}
- Frag.setContents(Contents);
- Frag.setFixups(Fixups);
+ Frag.setVarContents(Contents);
+ Frag.setVarFixups(Fixups);
}