[DebugInfo] Rename getOffset() to getContribution(). NFC.
The old name was a bit misleading because the functions actually return
contributions to the corresponding sections.
Differential revision: https://reviews.llvm.org/D77302
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 0198a10..8447d4f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -263,7 +263,8 @@
lldb::offset_t baseOffset = 0;
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
- if (const auto *contribution = entry->getOffset(llvm::DW_SECT_STR_OFFSETS))
+ if (const auto *contribution =
+ entry->getContribution(llvm::DW_SECT_STR_OFFSETS))
baseOffset = contribution->Offset;
else
return;
@@ -479,7 +480,7 @@
const DWARFDataExtractor &data =
GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() : Ctx.getOrLoadLocData();
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
- if (const auto *contribution = entry->getOffset(llvm::DW_SECT_LOC))
+ if (const auto *contribution = entry->getContribution(llvm::DW_SECT_LOC))
return DWARFDataExtractor(data, contribution->Offset,
contribution->Length);
return DWARFDataExtractor();
@@ -815,12 +816,13 @@
llvm::inconvertibleErrorCode(),
"Package unit with a non-zero abbreviation offset");
}
- auto *unit_contrib = header.m_index_entry->getOffset();
+ auto *unit_contrib = header.m_index_entry->getContribution();
if (!unit_contrib || unit_contrib->Length != header.m_length + 4) {
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"Inconsistent DWARF package unit index");
}
- auto *abbr_entry = header.m_index_entry->getOffset(llvm::DW_SECT_ABBREV);
+ auto *abbr_entry =
+ header.m_index_entry->getContribution(llvm::DW_SECT_ABBREV);
if (!abbr_entry) {
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index da8fec4..9bf3206 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -38,7 +38,7 @@
DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
if (const llvm::DWARFUnitIndex &index = m_context.GetAsLLVM().getCUIndex()) {
if (const llvm::DWARFUnitIndex::Entry *entry = index.getFromHash(hash)) {
- if (auto *unit_contrib = entry->getOffset())
+ if (auto *unit_contrib = entry->getContribution())
return llvm::dyn_cast_or_null<DWARFCompileUnit>(
DebugInfo().GetUnitAtOffset(DIERef::Section::DebugInfo,
unit_contrib->Offset));
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index 1d313a3..635c437 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -487,7 +487,7 @@
uint32_t getLineTableOffset() const {
if (auto IndexEntry = Header.getIndexEntry())
- if (const auto *Contrib = IndexEntry->getOffset(DW_SECT_LINE))
+ if (const auto *Contrib = IndexEntry->getContribution(DW_SECT_LINE))
return Contrib->Offset;
return 0;
}
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
index 684103a..d6b5e72 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
@@ -56,10 +56,10 @@
friend class DWARFUnitIndex;
public:
- const SectionContribution *getOffset(DWARFSectionKind Sec) const;
- const SectionContribution *getOffset() const;
+ const SectionContribution *getContribution(DWARFSectionKind Sec) const;
+ const SectionContribution *getContribution() const;
- const SectionContribution *getOffsets() const {
+ const SectionContribution *getContributions() const {
return Contributions.get();
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 9e71ef5..80f09dbd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -139,7 +139,7 @@
DWARFUnit *
DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
- const auto *CUOff = E.getOffset(DW_SECT_INFO);
+ const auto *CUOff = E.getContribution(DW_SECT_INFO);
if (!CUOff)
return nullptr;
@@ -183,7 +183,7 @@
// data based on the index entries.
StringRef Data = LocSection->Data;
if (auto *IndexEntry = Header.getIndexEntry())
- if (const auto *C = IndexEntry->getOffset(DW_SECT_LOC))
+ if (const auto *C = IndexEntry->getContribution(DW_SECT_LOC))
Data = Data.substr(C->Offset, C->Length);
DWARFDataExtractor DWARFData =
@@ -294,11 +294,11 @@
if (IndexEntry) {
if (AbbrOffset)
return false;
- auto *UnitContrib = IndexEntry->getOffset();
+ auto *UnitContrib = IndexEntry->getContribution();
if (!UnitContrib ||
UnitContrib->Length != (Length + getUnitLengthFieldByteSize()))
return false;
- auto *AbbrEntry = IndexEntry->getOffset(DW_SECT_ABBREV);
+ auto *AbbrEntry = IndexEntry->getContribution(DW_SECT_ABBREV);
if (!AbbrEntry)
return false;
AbbrOffset = AbbrEntry->Offset;
@@ -966,7 +966,7 @@
uint64_t Offset = 0;
auto IndexEntry = Header.getIndexEntry();
const auto *C =
- IndexEntry ? IndexEntry->getOffset(DW_SECT_STR_OFFSETS) : nullptr;
+ IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) : nullptr;
if (C)
Offset = C->Offset;
if (getVersion() >= 5) {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
index 2780abf..bdfdb18 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -154,7 +154,7 @@
}
const DWARFUnitIndex::Entry::SectionContribution *
-DWARFUnitIndex::Entry::getOffset(DWARFSectionKind Sec) const {
+DWARFUnitIndex::Entry::getContribution(DWARFSectionKind Sec) const {
uint32_t i = 0;
for (; i != Index->Header.NumColumns; ++i)
if (Index->ColumnKinds[i] == Sec)
@@ -163,7 +163,7 @@
}
const DWARFUnitIndex::Entry::SectionContribution *
-DWARFUnitIndex::Entry::getOffset() const {
+DWARFUnitIndex::Entry::getContribution() const {
return &Contributions[Index->InfoColumn];
}
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 51b3470..2a17819 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -219,7 +219,7 @@
static StringRef getSubsection(StringRef Section,
const DWARFUnitIndex::Entry &Entry,
DWARFSectionKind Kind) {
- const auto *Off = Entry.getOffset(Kind);
+ const auto *Off = Entry.getContribution(Kind);
if (!Off)
return StringRef();
return Section.substr(Off->Offset, Off->Length);
@@ -231,7 +231,7 @@
const UnitIndexEntry &TUEntry, uint32_t &TypesOffset) {
Out.SwitchSection(OutputTypes);
for (const DWARFUnitIndex::Entry &E : TUIndex.getRows()) {
- auto *I = E.getOffsets();
+ auto *I = E.getContributions();
if (!I)
continue;
auto P = TypeIndexEntries.insert(std::make_pair(E.getSignature(), TUEntry));
@@ -599,7 +599,7 @@
return make_error<DWPError>("failed to parse cu_index");
for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) {
- auto *I = E.getOffsets();
+ auto *I = E.getContributions();
if (!I)
continue;
auto P = IndexEntries.insert(std::make_pair(E.getSignature(), CurEntry));