[PATCH] D153065: [nfc][AppleTables] Rename iterator
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 16 08:47:40 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0b49e503a5bb: [nfc][AppleTables] Rename iterator (authored by fdeazeve).
Changed prior to commit:
https://reviews.llvm.org/D153065?vs=531871&id=532177#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153065/new/
https://reviews.llvm.org/D153065
Files:
llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
Index: llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ 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<AppleAcceleratorTable::ValueIterator>
+iterator_range<AppleAcceleratorTable::SameNameIterator>
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);
}
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -214,27 +214,29 @@
};
/// An iterator for Entries all having the same string as key.
- class ValueIterator {
+ class SameNameIterator
+ : public iterator_facade_base<SameNameIterator, std::forward_iterator_tag,
+ Entry> {
Entry Current;
uint64_t Offset = 0;
- void Next() { Offset += Current.Table.getHashDataEntryLength(); }
-
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) {
- return A.Offset == B.Offset;
+ SameNameIterator &operator++() {
+ Offset += Current.Table.getHashDataEntryLength();
+ return *this;
}
- friend bool operator!=(const ValueIterator &A, const ValueIterator &B) {
- return !(A == B);
+ friend bool operator==(const SameNameIterator &A,
+ const SameNameIterator &B) {
+ return A.Offset == B.Offset;
}
};
@@ -268,7 +270,7 @@
void dump(raw_ostream &OS) const override;
/// Look up all entries in the accelerator table matching \c Key.
- iterator_range<ValueIterator> equal_range(StringRef Key) const;
+ iterator_range<SameNameIterator> equal_range(StringRef Key) const;
};
/// .debug_names section consists of one or more units. Each unit starts with a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153065.532177.patch
Type: text/x-patch
Size: 3361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230616/69ebe352/attachment.bin>
More information about the llvm-commits
mailing list