diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h index 0bade10f6201..391c72018ae6 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h @@ -24,7 +24,7 @@ class raw_ostream; /// This implements the Apple accelerator table format, a precursor of the /// DWARF 5 accelerator table format. /// TODO: Factor out a common base class for both formats. -class DWARFAcceleratorTable { +class AppleAcceleratorTable { struct Header { uint32_t Magic; uint16_t Version; @@ -53,7 +53,7 @@ public: /// multiple DWARFFormValues. class ValueIterator : public std::iterator> { - const DWARFAcceleratorTable *AccelTable = nullptr; + const AppleAcceleratorTable *AccelTable = nullptr; SmallVector AtomForms; ///< The decoded data entry. unsigned DataOffset = 0; ///< Offset into the section. @@ -64,7 +64,7 @@ public: void Next(); public: /// Construct a new iterator for the entries at \p DataOffset. - ValueIterator(const DWARFAcceleratorTable &AccelTable, unsigned DataOffset); + ValueIterator(const AppleAcceleratorTable &AccelTable, unsigned DataOffset); /// End marker. ValueIterator() = default; @@ -86,7 +86,7 @@ public: }; - DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection, + AppleAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection) : AccelSection(AccelSection), StringSection(StringSection) {} diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h index 2ddbc4b91ba2..476c0f1bdfe9 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h @@ -69,10 +69,10 @@ class DWARFContext : public DIContext { std::unique_ptr DebugFrame; std::unique_ptr EHFrame; std::unique_ptr Macro; - std::unique_ptr AppleNames; - std::unique_ptr AppleTypes; - std::unique_ptr AppleNamespaces; - std::unique_ptr AppleObjC; + std::unique_ptr AppleNames; + std::unique_ptr AppleTypes; + std::unique_ptr AppleNamespaces; + std::unique_ptr AppleObjC; DWARFUnitSection DWOCUs; std::deque> DWOTUs; @@ -243,16 +243,16 @@ public: const DWARFDebugMacro *getDebugMacro(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleNames(); + const AppleAcceleratorTable &getAppleNames(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleTypes(); + const AppleAcceleratorTable &getAppleTypes(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleNamespaces(); + const AppleAcceleratorTable &getAppleNamespaces(); /// Get a reference to the parsed accelerator table object. - const DWARFAcceleratorTable &getAppleObjC(); + const AppleAcceleratorTable &getAppleObjC(); /// Get a pointer to a parsed line table corresponding to a compile unit. const DWARFDebugLine::LineTable *getLineTableForUnit(DWARFUnit *cu); diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h index 0d920abe3231..c427a07ccc14 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h @@ -24,7 +24,6 @@ struct DWARFAttribute; class DWARFContext; class DWARFDie; class DWARFUnit; -class DWARFAcceleratorTable; class DWARFDataExtractor; class DWARFDebugAbbrev; class DataExtractor; @@ -229,8 +228,9 @@ private: /// \param SectionName the name of the table we're verifying /// /// \returns The number of errors occured during verification - unsigned verifyAccelTable(const DWARFSection *AccelSection, - DataExtractor *StrData, const char *SectionName); + unsigned verifyAppleAccelTable(const DWARFSection *AccelSection, + DataExtractor *StrData, + const char *SectionName); public: DWARFVerifier(raw_ostream &S, DWARFContext &D, diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp index 6a6b7fc6fc20..ac30f74f3466 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -21,7 +21,7 @@ using namespace llvm; -llvm::Error DWARFAcceleratorTable::extract() { +llvm::Error AppleAcceleratorTable::extract() { uint32_t Offset = 0; // Check that we can at least read the header. @@ -59,20 +59,20 @@ llvm::Error DWARFAcceleratorTable::extract() { return Error::success(); } -uint32_t DWARFAcceleratorTable::getNumBuckets() { return Hdr.NumBuckets; } -uint32_t DWARFAcceleratorTable::getNumHashes() { return Hdr.NumHashes; } -uint32_t DWARFAcceleratorTable::getSizeHdr() { return sizeof(Hdr); } -uint32_t DWARFAcceleratorTable::getHeaderDataLength() { +uint32_t AppleAcceleratorTable::getNumBuckets() { return Hdr.NumBuckets; } +uint32_t AppleAcceleratorTable::getNumHashes() { return Hdr.NumHashes; } +uint32_t AppleAcceleratorTable::getSizeHdr() { return sizeof(Hdr); } +uint32_t AppleAcceleratorTable::getHeaderDataLength() { return Hdr.HeaderDataLength; } -ArrayRef> -DWARFAcceleratorTable::getAtomsDesc() { +ArrayRef> +AppleAcceleratorTable::getAtomsDesc() { return HdrData.Atoms; } -bool DWARFAcceleratorTable::validateForms() { +bool AppleAcceleratorTable::validateForms() { for (auto Atom : getAtomsDesc()) { DWARFFormValue FormValue(Atom.second); switch (Atom.first) { @@ -92,7 +92,7 @@ bool DWARFAcceleratorTable::validateForms() { } std::pair -DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { +AppleAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { uint32_t DieOffset = dwarf::DW_INVALID_OFFSET; dwarf::Tag DieTag = dwarf::DW_TAG_null; DWARFFormParams FormParams = {Hdr.Version, 0, dwarf::DwarfFormat::DWARF32}; @@ -114,7 +114,7 @@ DWARFAcceleratorTable::readAtoms(uint32_t &HashDataOffset) { return {DieOffset, DieTag}; } -LLVM_DUMP_METHOD void DWARFAcceleratorTable::dump(raw_ostream &OS) const { +LLVM_DUMP_METHOD void AppleAcceleratorTable::dump(raw_ostream &OS) const { if (!IsValid) return; @@ -201,8 +201,8 @@ LLVM_DUMP_METHOD void DWARFAcceleratorTable::dump(raw_ostream &OS) const { } } -DWARFAcceleratorTable::ValueIterator::ValueIterator( - const DWARFAcceleratorTable &AccelTable, unsigned Offset) +AppleAcceleratorTable::ValueIterator::ValueIterator( + const AppleAcceleratorTable &AccelTable, unsigned Offset) : AccelTable(&AccelTable), DataOffset(Offset) { if (!AccelTable.AccelSection.isValidOffsetForDataOfSize(DataOffset, 4)) return; @@ -215,7 +215,7 @@ DWARFAcceleratorTable::ValueIterator::ValueIterator( Next(); } -void DWARFAcceleratorTable::ValueIterator::Next() { +void AppleAcceleratorTable::ValueIterator::Next() { assert(NumData > 0 && "attempted to increment iterator past the end"); auto &AccelSection = AccelTable->AccelSection; if (Data >= NumData || @@ -230,8 +230,8 @@ void DWARFAcceleratorTable::ValueIterator::Next() { ++Data; } -iterator_range -DWARFAcceleratorTable::equal_range(StringRef Key) const { +iterator_range +AppleAcceleratorTable::equal_range(StringRef Key) const { if (!IsValid) return make_range(ValueIterator(), ValueIterator()); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index cbcb32c94583..76be5d7e6e70 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -703,37 +703,37 @@ const DWARFDebugMacro *DWARFContext::getDebugMacro() { return Macro.get(); } -static DWARFAcceleratorTable & -getAccelTable(std::unique_ptr &Cache, +static AppleAcceleratorTable & +getAccelTable(std::unique_ptr &Cache, const DWARFObject &Obj, const DWARFSection &Section, StringRef StringSection, bool IsLittleEndian) { if (Cache) return *Cache; DWARFDataExtractor AccelSection(Obj, Section, IsLittleEndian, 0); DataExtractor StrData(StringSection, IsLittleEndian, 0); - Cache.reset(new DWARFAcceleratorTable(AccelSection, StrData)); + Cache.reset(new AppleAcceleratorTable(AccelSection, StrData)); if (Error E = Cache->extract()) llvm::consumeError(std::move(E)); return *Cache; } -const DWARFAcceleratorTable &DWARFContext::getAppleNames() { +const AppleAcceleratorTable &DWARFContext::getAppleNames() { return getAccelTable(AppleNames, *DObj, DObj->getAppleNamesSection(), DObj->getStringSection(), isLittleEndian()); } -const DWARFAcceleratorTable &DWARFContext::getAppleTypes() { +const AppleAcceleratorTable &DWARFContext::getAppleTypes() { return getAccelTable(AppleTypes, *DObj, DObj->getAppleTypesSection(), DObj->getStringSection(), isLittleEndian()); } -const DWARFAcceleratorTable &DWARFContext::getAppleNamespaces() { +const AppleAcceleratorTable &DWARFContext::getAppleNamespaces() { return getAccelTable(AppleNamespaces, *DObj, DObj->getAppleNamespacesSection(), DObj->getStringSection(), isLittleEndian()); } -const DWARFAcceleratorTable &DWARFContext::getAppleObjC() { +const AppleAcceleratorTable &DWARFContext::getAppleObjC() { return getAccelTable(AppleObjC, *DObj, DObj->getAppleObjCSection(), DObj->getStringSection(), isLittleEndian()); } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 3d473698b463..da3226ed0a2f 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -669,13 +669,13 @@ bool DWARFVerifier::handleDebugLine() { return NumDebugLineErrors == 0; } -unsigned DWARFVerifier::verifyAccelTable(const DWARFSection *AccelSection, - DataExtractor *StrData, - const char *SectionName) { +unsigned DWARFVerifier::verifyAppleAccelTable(const DWARFSection *AccelSection, + DataExtractor *StrData, + const char *SectionName) { unsigned NumErrors = 0; DWARFDataExtractor AccelSectionData(DCtx.getDWARFObj(), *AccelSection, DCtx.isLittleEndian(), 0); - DWARFAcceleratorTable AccelTable(AccelSectionData, *StrData); + AppleAcceleratorTable AccelTable(AccelSectionData, *StrData); OS << "Verifying " << SectionName << "...\n"; @@ -779,16 +779,16 @@ bool DWARFVerifier::handleAccelTables() { unsigned NumErrors = 0; if (!D.getAppleNamesSection().Data.empty()) NumErrors += - verifyAccelTable(&D.getAppleNamesSection(), &StrData, ".apple_names"); + verifyAppleAccelTable(&D.getAppleNamesSection(), &StrData, ".apple_names"); if (!D.getAppleTypesSection().Data.empty()) NumErrors += - verifyAccelTable(&D.getAppleTypesSection(), &StrData, ".apple_types"); + verifyAppleAccelTable(&D.getAppleTypesSection(), &StrData, ".apple_types"); if (!D.getAppleNamespacesSection().Data.empty()) - NumErrors += verifyAccelTable(&D.getAppleNamespacesSection(), &StrData, + NumErrors += verifyAppleAccelTable(&D.getAppleNamespacesSection(), &StrData, ".apple_namespaces"); if (!D.getAppleObjCSection().Data.empty()) NumErrors += - verifyAccelTable(&D.getAppleObjCSection(), &StrData, ".apple_objc"); + verifyAppleAccelTable(&D.getAppleObjCSection(), &StrData, ".apple_objc"); return NumErrors == 0; } diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 12c005de6005..1142fe3319c7 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -363,7 +363,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename, if (!Find.empty()) { DumpOffsets[DIDT_ID_DebugInfo] = [&]() -> llvm::Optional { for (auto Name : Find) { - auto find = [&](const DWARFAcceleratorTable &Accel) + auto find = [&](const AppleAcceleratorTable &Accel) -> llvm::Optional { for (auto Entry : Accel.equal_range(Name)) for (auto Atom : Entry)