diff options
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r-- | llvm/lib/MC/MCCodeView.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index e8f0427..5d79143 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -510,8 +510,7 @@ void CodeViewContext::encodeInlineLineTable(const MCAssembler &Asm, MCCVFunctionInfo *SiteInfo = getCVFunctionInfo(Frag.SiteFuncId); - SmallVectorImpl<char> &Buffer = Frag.getContents(); - Buffer.clear(); // Clear old contents if we went through relaxation. + SmallVector<char, 0> Buffer; for (const MCCVLoc &Loc : Locs) { // Exit early if our line table would produce an oversized InlineSiteSym // record. Account for the ChangeCodeLength annotation emitted after the @@ -604,15 +603,14 @@ void CodeViewContext::encodeInlineLineTable(const MCAssembler &Asm, compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer); compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer); + Frag.setContents(Buffer); } void CodeViewContext::encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &Frag) { MCContext &Ctx = Asm.getContext(); - SmallVectorImpl<char> &Contents = Frag.getContents(); - Contents.clear(); - SmallVectorImpl<MCFixup> &Fixups = Frag.getFixups(); - Fixups.clear(); + SmallVector<char, 0> Contents; + SmallVector<MCFixup, 0> Fixups; raw_svector_ostream OS(Contents); // Compute all the sizes up front. @@ -692,4 +690,7 @@ void CodeViewContext::encodeDefRange(const MCAssembler &Asm, GapStartOffset += GapSize + RangeSize; } } + + Frag.setContents(Contents); + Frag.setFixups(Fixups); } |