Skip to content

Commit f13ce15

Browse files
committed
[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
1 parent 69c8fb1 commit f13ce15

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ void DWARFUnit::SetDwoStrOffsetsBase() {
263263
lldb::offset_t baseOffset = 0;
264264

265265
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
266-
if (const auto *contribution = entry->getOffset(llvm::DW_SECT_STR_OFFSETS))
266+
if (const auto *contribution =
267+
entry->getContribution(llvm::DW_SECT_STR_OFFSETS))
267268
baseOffset = contribution->Offset;
268269
else
269270
return;
@@ -479,7 +480,7 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
479480
const DWARFDataExtractor &data =
480481
GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() : Ctx.getOrLoadLocData();
481482
if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
482-
if (const auto *contribution = entry->getOffset(llvm::DW_SECT_LOC))
483+
if (const auto *contribution = entry->getContribution(llvm::DW_SECT_LOC))
483484
return DWARFDataExtractor(data, contribution->Offset,
484485
contribution->Length);
485486
return DWARFDataExtractor();
@@ -815,12 +816,13 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data,
815816
llvm::inconvertibleErrorCode(),
816817
"Package unit with a non-zero abbreviation offset");
817818
}
818-
auto *unit_contrib = header.m_index_entry->getOffset();
819+
auto *unit_contrib = header.m_index_entry->getContribution();
819820
if (!unit_contrib || unit_contrib->Length != header.m_length + 4) {
820821
return llvm::createStringError(llvm::inconvertibleErrorCode(),
821822
"Inconsistent DWARF package unit index");
822823
}
823-
auto *abbr_entry = header.m_index_entry->getOffset(llvm::DW_SECT_ABBREV);
824+
auto *abbr_entry =
825+
header.m_index_entry->getContribution(llvm::DW_SECT_ABBREV);
824826
if (!abbr_entry) {
825827
return llvm::createStringError(
826828
llvm::inconvertibleErrorCode(),

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SymbolFileDWARFDwo::SymbolFileDWARFDwo(SymbolFileDWARF &base_symbol_file,
3838
DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
3939
if (const llvm::DWARFUnitIndex &index = m_context.GetAsLLVM().getCUIndex()) {
4040
if (const llvm::DWARFUnitIndex::Entry *entry = index.getFromHash(hash)) {
41-
if (auto *unit_contrib = entry->getOffset())
41+
if (auto *unit_contrib = entry->getContribution())
4242
return llvm::dyn_cast_or_null<DWARFCompileUnit>(
4343
DebugInfo().GetUnitAtOffset(DIERef::Section::DebugInfo,
4444
unit_contrib->Offset));

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class DWARFUnit {
487487

488488
uint32_t getLineTableOffset() const {
489489
if (auto IndexEntry = Header.getIndexEntry())
490-
if (const auto *Contrib = IndexEntry->getOffset(DW_SECT_LINE))
490+
if (const auto *Contrib = IndexEntry->getContribution(DW_SECT_LINE))
491491
return Contrib->Offset;
492492
return 0;
493493
}

llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class DWARFUnitIndex {
5656
friend class DWARFUnitIndex;
5757

5858
public:
59-
const SectionContribution *getOffset(DWARFSectionKind Sec) const;
60-
const SectionContribution *getOffset() const;
59+
const SectionContribution *getContribution(DWARFSectionKind Sec) const;
60+
const SectionContribution *getContribution() const;
6161

62-
const SectionContribution *getOffsets() const {
62+
const SectionContribution *getContributions() const {
6363
return Contributions.get();
6464
}
6565

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ DWARFUnit *DWARFUnitVector::getUnitForOffset(uint64_t Offset) const {
139139

140140
DWARFUnit *
141141
DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
142-
const auto *CUOff = E.getOffset(DW_SECT_INFO);
142+
const auto *CUOff = E.getContribution(DW_SECT_INFO);
143143
if (!CUOff)
144144
return nullptr;
145145

@@ -183,7 +183,7 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
183183
// data based on the index entries.
184184
StringRef Data = LocSection->Data;
185185
if (auto *IndexEntry = Header.getIndexEntry())
186-
if (const auto *C = IndexEntry->getOffset(DW_SECT_LOC))
186+
if (const auto *C = IndexEntry->getContribution(DW_SECT_LOC))
187187
Data = Data.substr(C->Offset, C->Length);
188188

189189
DWARFDataExtractor DWARFData =
@@ -294,11 +294,11 @@ bool DWARFUnitHeader::extract(DWARFContext &Context,
294294
if (IndexEntry) {
295295
if (AbbrOffset)
296296
return false;
297-
auto *UnitContrib = IndexEntry->getOffset();
297+
auto *UnitContrib = IndexEntry->getContribution();
298298
if (!UnitContrib ||
299299
UnitContrib->Length != (Length + getUnitLengthFieldByteSize()))
300300
return false;
301-
auto *AbbrEntry = IndexEntry->getOffset(DW_SECT_ABBREV);
301+
auto *AbbrEntry = IndexEntry->getContribution(DW_SECT_ABBREV);
302302
if (!AbbrEntry)
303303
return false;
304304
AbbrOffset = AbbrEntry->Offset;
@@ -966,7 +966,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) {
966966
uint64_t Offset = 0;
967967
auto IndexEntry = Header.getIndexEntry();
968968
const auto *C =
969-
IndexEntry ? IndexEntry->getOffset(DW_SECT_STR_OFFSETS) : nullptr;
969+
IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) : nullptr;
970970
if (C)
971971
Offset = C->Offset;
972972
if (getVersion() >= 5) {

llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const {
154154
}
155155

156156
const DWARFUnitIndex::Entry::SectionContribution *
157-
DWARFUnitIndex::Entry::getOffset(DWARFSectionKind Sec) const {
157+
DWARFUnitIndex::Entry::getContribution(DWARFSectionKind Sec) const {
158158
uint32_t i = 0;
159159
for (; i != Index->Header.NumColumns; ++i)
160160
if (Index->ColumnKinds[i] == Sec)
@@ -163,7 +163,7 @@ DWARFUnitIndex::Entry::getOffset(DWARFSectionKind Sec) const {
163163
}
164164

165165
const DWARFUnitIndex::Entry::SectionContribution *
166-
DWARFUnitIndex::Entry::getOffset() const {
166+
DWARFUnitIndex::Entry::getContribution() const {
167167
return &Contributions[Index->InfoColumn];
168168
}
169169

llvm/tools/llvm-dwp/llvm-dwp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct UnitIndexEntry {
219219
static StringRef getSubsection(StringRef Section,
220220
const DWARFUnitIndex::Entry &Entry,
221221
DWARFSectionKind Kind) {
222-
const auto *Off = Entry.getOffset(Kind);
222+
const auto *Off = Entry.getContribution(Kind);
223223
if (!Off)
224224
return StringRef();
225225
return Section.substr(Off->Offset, Off->Length);
@@ -231,7 +231,7 @@ static void addAllTypesFromDWP(
231231
const UnitIndexEntry &TUEntry, uint32_t &TypesOffset) {
232232
Out.SwitchSection(OutputTypes);
233233
for (const DWARFUnitIndex::Entry &E : TUIndex.getRows()) {
234-
auto *I = E.getOffsets();
234+
auto *I = E.getContributions();
235235
if (!I)
236236
continue;
237237
auto P = TypeIndexEntries.insert(std::make_pair(E.getSignature(), TUEntry));
@@ -599,7 +599,7 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
599599
return make_error<DWPError>("failed to parse cu_index");
600600

601601
for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) {
602-
auto *I = E.getOffsets();
602+
auto *I = E.getContributions();
603603
if (!I)
604604
continue;
605605
auto P = IndexEntries.insert(std::make_pair(E.getSignature(), CurEntry));

0 commit comments

Comments
 (0)