[PATCH] D151989: [AppleAccelTable][NFC] Refactor equal_range code

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 09:29:22 PDT 2023


aprantl added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp:343
+  for (uint64_t DataOffset = *MaybeDataOffset;
+       DataOffset < AccelSection.size();) {
+    std::optional<uint32_t> StrOffset = readStringOffsetAt(DataOffset);
----------------
This isn't really a loop, is it?
Maybe just use an if () statement and convert this to another early exit?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp:374
+    if (!MaybeHash || !wouldHashBeInBucket(*MaybeHash, BucketIdx))
       break;
+    if (*MaybeHash == HashToFind)
----------------
Feel free to ignore this suggestion, but we could consider returning an error with the offset of the failure here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151989/new/

https://reviews.llvm.org/D151989



More information about the llvm-commits mailing list