[Lldb-commits] [lldb] f13ce15 - [DebugInfo] Rename getOffset() to getContribution(). NFC.

Igor Kudrin via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 3 00:20:17 PDT 2020


Author: Igor Kudrin
Date: 2020-04-03T14:15:53+07:00
New Revision: f13ce15d441095493030404ab31eddb0fc08ca42

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

LOG: [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

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
    llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
    llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
    llvm/tools/llvm-dwp/llvm-dwp.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 0198a10645c2..8447d4fcea4c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -263,7 +263,8 @@ void DWARFUnit::SetDwoStrOffsetsBase() {
   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 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
   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 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data,
           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 da8fec46dba7..9bf3206f1c61 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -38,7 +38,7 @@ SymbolFileDWARFDwo::SymbolFileDWARFDwo(SymbolFileDWARF &base_symbol_file,
 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 1d313a3cca24..635c437fff10 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -487,7 +487,7 @@ class DWARFUnit {
 
   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 684103aac2fc..d6b5e72cf16c 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
@@ -56,10 +56,10 @@ class DWARFUnitIndex {
     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 9e71ef5f43f5..80f09dbd4c18 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -139,7 +139,7 @@ DWARFUnit *DWARFUnitVector::getUnitForOffset(uint64_t Offset) const {
 
 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 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
     // 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 @@ bool DWARFUnitHeader::extract(DWARFContext &Context,
   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 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) {
   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 2780abfcf03f..bdfdb1889c02 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -154,7 +154,7 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const {
 }
 
 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 @@ DWARFUnitIndex::Entry::getOffset(DWARFSectionKind Sec) const {
 }
 
 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 51b3470afee4..2a1781983c4e 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -219,7 +219,7 @@ struct UnitIndexEntry {
 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 @@ static void addAllTypesFromDWP(
     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 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
       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));


        


More information about the lldb-commits mailing list