diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h @@ -214,7 +214,7 @@ }; /// An iterator for Entries all having the same string as key. - class ValueIterator { + class SameNameIterator { Entry Current; uint64_t Offset = 0; @@ -222,18 +222,24 @@ public: /// Construct a new iterator for the entries at \p DataOffset. - ValueIterator(const AppleAcceleratorTable &AccelTable, uint64_t DataOffset); + SameNameIterator(const AppleAcceleratorTable &AccelTable, + uint64_t DataOffset); const Entry &operator*() { uint64_t OffsetCopy = Offset; Current.extract(&OffsetCopy); return Current; } - ValueIterator &operator++() { Next(); return *this; } - friend bool operator==(const ValueIterator &A, const ValueIterator &B) { + SameNameIterator &operator++() { + Next(); + return *this; + } + friend bool operator==(const SameNameIterator &A, + const SameNameIterator &B) { return A.Offset == B.Offset; } - friend bool operator!=(const ValueIterator &A, const ValueIterator &B) { + friend bool operator!=(const SameNameIterator &A, + const SameNameIterator &B) { return !(A == B); } }; @@ -268,7 +274,7 @@ void dump(raw_ostream &OS) const override; /// Look up all entries in the accelerator table matching \c Key. - iterator_range equal_range(StringRef Key) const; + iterator_range equal_range(StringRef Key) const; }; /// .debug_names section consists of one or more units. Each unit starts with a diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -305,15 +305,14 @@ return std::nullopt; } -AppleAcceleratorTable::ValueIterator::ValueIterator( +AppleAcceleratorTable::SameNameIterator::SameNameIterator( const AppleAcceleratorTable &AccelTable, uint64_t DataOffset) - : Current(AccelTable), Offset(DataOffset) { -} + : Current(AccelTable), Offset(DataOffset) {} -iterator_range +iterator_range AppleAcceleratorTable::equal_range(StringRef Key) const { const auto EmptyRange = - make_range(ValueIterator(*this, 0), ValueIterator(*this, 0)); + make_range(SameNameIterator(*this, 0), SameNameIterator(*this, 0)); if (!IsValid) return EmptyRange; @@ -341,7 +340,8 @@ return EmptyRange; uint64_t EndOffset = DataOffset + *NumEntries * getHashDataEntryLength(); if (Key == *MaybeStr) - return make_range({*this, DataOffset}, ValueIterator{*this, EndOffset}); + return make_range({*this, DataOffset}, + SameNameIterator{*this, EndOffset}); DataOffset = EndOffset; StrOffset = readStringOffsetAt(DataOffset); }