[PATCH] D153065: [nfc][AppleTables] Rename iterator

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 12:14:58 PDT 2023


fdeazeve created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We will soon need different kinds of iterators


Repository:
  rG LLVM Github Monorepo

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,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<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.531871.patch
Type: text/x-patch
Size: 3223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230615/eae5cf97/attachment.bin>


More information about the llvm-commits mailing list