[llvm] 9fbde32 - Revert "CodeView: Move MCCVDefRangeFragment storage to MCContext/MCFragment"

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 01:09:29 PDT 2025


Author: David Spickett
Date: 2025-06-30T08:09:22Z
New Revision: 9fbde32a8c75a288d237e74d0a459ec7dc7698d8

URL: https://github.com/llvm/llvm-project/commit/9fbde32a8c75a288d237e74d0a459ec7dc7698d8
DIFF: https://github.com/llvm/llvm-project/commit/9fbde32a8c75a288d237e74d0a459ec7dc7698d8.diff

LOG: Revert "CodeView: Move MCCVDefRangeFragment storage to MCContext/MCFragment"

This reverts commit e47d4010d34119c2b4a28e7609fde35449a8b437.

Causing a few tests to crash on Windows buildbots.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCCodeView.h
    llvm/include/llvm/MC/MCFragment.h
    llvm/lib/MC/MCCodeView.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCCodeView.h b/llvm/include/llvm/MC/MCCodeView.h
index 3219a2ec061cb..2a57e04b2c88c 100644
--- a/llvm/include/llvm/MC/MCCodeView.h
+++ b/llvm/include/llvm/MC/MCCodeView.h
@@ -18,7 +18,6 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include <deque>
 #include <map>
 #include <vector>
 
@@ -269,9 +268,6 @@ class CodeViewContext {
   /// Indicate whether we have already laid out the checksum table addresses or
   /// not.
   bool ChecksumOffsetsAssigned = false;
-
-  /// Storage of MCCVDefRangeFragment::Ranges.
-  std::deque<std::pair<const MCSymbol *, const MCSymbol *>> DefRangeStorage;
 };
 
 } // end namespace llvm

diff  --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 2affa85c744ba..7bb090d0c57a1 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -492,8 +492,8 @@ class MCCVInlineLineTableFragment : public MCFragment {
 
 /// Fragment representing the .cv_def_range directive.
 class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
-  ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges;
-  StringRef FixedSizePortion;
+  SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 2> Ranges;
+  SmallString<32> FixedSizePortion;
 
   /// CodeViewContext has the real knowledge about this format, so let it access
   /// our members.
@@ -510,7 +510,7 @@ class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
     return Ranges;
   }
 
-  StringRef getFixedSizePortion() const { return FixedSizePortion; }
+  StringRef getFixedSizePortion() const { return FixedSizePortion.str(); }
 
   static bool classof(const MCFragment *F) {
     return F->getKind() == MCFragment::FT_CVDefRange;

diff  --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index e05374783d2b4..1407bc52e1c46 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -444,11 +444,6 @@ MCFragment *CodeViewContext::emitDefRange(
     StringRef FixedSizePortion) {
   // Create and insert a fragment into the current section that will be encoded
   // later.
-  FixedSizePortion = MCCtx->allocateString(FixedSizePortion);
-  auto Pos = DefRangeStorage.size();
-  llvm::append_range(DefRangeStorage, Ranges);
-  if (!Ranges.empty())
-    Ranges = {&DefRangeStorage[Pos], Ranges.size()};
   auto *F =
       MCCtx->allocFragment<MCCVDefRangeFragment>(Ranges, FixedSizePortion);
   OS.insert(F);


        


More information about the llvm-commits mailing list