CodeView: Move MCCVDefRangeFragment storage to MCContext/MCFragment
Work toward making ~MCCVInlineLineTableFragment trivial.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -268,6 +269,9 @@ private:
|
||||
/// 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
|
||||
|
||||
@@ -492,8 +492,8 @@ public:
|
||||
|
||||
/// Fragment representing the .cv_def_range directive.
|
||||
class MCCVDefRangeFragment : public MCEncodedFragmentWithFixups<32, 4> {
|
||||
SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 2> Ranges;
|
||||
SmallString<32> FixedSizePortion;
|
||||
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges;
|
||||
StringRef FixedSizePortion;
|
||||
|
||||
/// CodeViewContext has the real knowledge about this format, so let it access
|
||||
/// our members.
|
||||
@@ -510,7 +510,7 @@ public:
|
||||
return Ranges;
|
||||
}
|
||||
|
||||
StringRef getFixedSizePortion() const { return FixedSizePortion.str(); }
|
||||
StringRef getFixedSizePortion() const { return FixedSizePortion; }
|
||||
|
||||
static bool classof(const MCFragment *F) {
|
||||
return F->getKind() == MCFragment::FT_CVDefRange;
|
||||
|
||||
@@ -444,6 +444,11 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user