[DebugInfo/DWARF] [3/4] Rename DWARFUnitSection to DWARFUnitVector. NFC
This is patch 3 of 4 NFC refactorings to handle type units and compile
units more consistently and with less concern about the object-file
section that they came from.
Patch 3 simply renames DWARFUnitSection to DWARFUnitVector, as the
object-file section of a unit is nearly irrelevant now.
Differential Revision: https://reviews.llvm.org/D49743
llvm-svn: 338632
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 904ceab..654d205 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -350,7 +350,7 @@
DWARFDie
DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const {
if (auto SpecRef = toReference(find(Attr))) {
- if (auto SpecUnit = U->getUnitSection().getUnitForOffset(*SpecRef))
+ if (auto SpecUnit = U->getUnitVector().getUnitForOffset(*SpecRef))
return SpecUnit->getDIEForOffset(*SpecRef);
}
return DWARFDie();
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index c11bbba..671fdeb 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -33,9 +33,9 @@
using namespace llvm;
using namespace dwarf;
-void DWARFUnitSection::addUnitsForSection(DWARFContext &C,
- const DWARFSection &Section,
- DWARFSectionKind SectionKind) {
+void DWARFUnitVector::addUnitsForSection(DWARFContext &C,
+ const DWARFSection &Section,
+ DWARFSectionKind SectionKind) {
const DWARFObject &D = C.getDWARFObj();
addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangeSection(),
D.getStringSection(), D.getStringOffsetSection(),
@@ -43,10 +43,10 @@
false, false, SectionKind);
}
-void DWARFUnitSection::addUnitsForDWOSection(DWARFContext &C,
- const DWARFSection &DWOSection,
- DWARFSectionKind SectionKind,
- bool Lazy) {
+void DWARFUnitVector::addUnitsForDWOSection(DWARFContext &C,
+ const DWARFSection &DWOSection,
+ DWARFSectionKind SectionKind,
+ bool Lazy) {
const DWARFObject &D = C.getDWARFObj();
addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangeDWOSection(),
D.getStringDWOSection(), D.getStringOffsetDWOSection(),
@@ -54,7 +54,7 @@
true, Lazy, SectionKind);
}
-void DWARFUnitSection::addUnitsImpl(
+void DWARFUnitVector::addUnitsImpl(
DWARFContext &Context, const DWARFObject &Obj, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS,
@@ -104,7 +104,7 @@
}
}
-DWARFUnit *DWARFUnitSection::getUnitForOffset(uint32_t Offset) const {
+DWARFUnit *DWARFUnitVector::getUnitForOffset(uint32_t Offset) const {
auto *CU = std::upper_bound(
this->begin(), this->end(), Offset,
[](uint32_t LHS, const std::unique_ptr<DWARFUnit> &RHS) {
@@ -116,7 +116,7 @@
}
DWARFUnit *
-DWARFUnitSection::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
+DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
const auto *CUOff = E.getOffset(DW_SECT_INFO);
if (!CUOff)
return nullptr;
@@ -148,11 +148,11 @@
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
StringRef SS, const DWARFSection &SOS,
const DWARFSection *AOS, const DWARFSection &LS, bool LE,
- bool IsDWO, const DWARFUnitSection &UnitSection)
+ bool IsDWO, const DWARFUnitVector &UnitVector)
: Context(DC), InfoSection(Section), Header(Header), Abbrev(DA),
RangeSection(RS), LineSection(LS), StringSection(SS),
StringOffsetSection(SOS), AddrOffsetSection(AOS), isLittleEndian(LE),
- isDWO(IsDWO), UnitSection(UnitSection) {
+ isDWO(IsDWO), UnitVector(UnitVector) {
clear();
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index cf1bdc2..d4677f6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -264,7 +264,7 @@
bool isUnitDWARF64 = false;
bool isHeaderChainValid = true;
bool hasDIE = DebugInfoData.isValidOffset(Offset);
- DWARFUnitSection UnitSection{};
+ DWARFUnitVector UnitVector{};
while (hasDIE) {
OffsetStart = Offset;
if (!verifyUnitHeader(DebugInfoData, &Offset, UnitIdx, UnitType,
@@ -283,7 +283,7 @@
DCtx, DObj.getInfoSection(), Header, DCtx.getDebugAbbrev(),
&DObj.getRangeSection(), DObj.getStringSection(),
DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
- DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitSection));
+ DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitVector));
break;
}
case dwarf::DW_UT_skeleton:
@@ -297,7 +297,7 @@
DCtx, DObj.getInfoSection(), Header, DCtx.getDebugAbbrev(),
&DObj.getRangeSection(), DObj.getStringSection(),
DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
- DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitSection));
+ DObj.getLineSection(), DCtx.isLittleEndian(), false, UnitVector));
break;
}
default: { llvm_unreachable("Invalid UnitType."); }