[PATCH] D112513: [ELF] Replace InputBaseSection::{areRelocsRela,firstRelocation,numRelocation} with relSecIdx

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 26 02:51:06 PDT 2021


arichardson added a comment.

Nice and easy size reduction :) It seems unlikely that the calls to `relsOrRelas()` add noticeable overhead compared to looking at the cached values. Would prefer a named struct over std::pair though.



================
Comment at: lld/ELF/InputSection.cpp:163
+template <class ELFT>
+std::pair<ArrayRef<typename ELFT::Rel>, ArrayRef<typename ELFT::Rela>>
+InputSectionBase::relsOrRelas() const {
----------------
I would define a struct for the two arrays instead of using std::pair since it's not obvious what `.first`/`.second` is accessing in the rest of the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112513



More information about the llvm-commits mailing list