[PATCH] D90614: [lld-macho] Handle paired relocs

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 23:27:00 PST 2020


gkm marked an inline comment as done.
gkm added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:181
+    const relocation_info relInfo =
+        (target->isPairedReloc(pairedInfo) ? relInfos[++i] : pairedInfo);
+    assert(i < relInfos.size());
----------------
gkm wrote:
> compnerd wrote:
> > You could also do `std::next(&RI)` if you want to continue using the range based for loop.
> That's an improvement! 😺
Only in concept ... it doesn't work in practice. `std::next()` accepts and returns an iterator. Range-based `for` keeps the iterator behind the scenes. The best I can do to make this more C++ish is to use an iterator object with `std::next()` vs. integer array index with ordinary arithmetic. Methinks there is no great advantage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90614



More information about the llvm-commits mailing list