[PATCH] D83935: [llvm-readobj] - Move out the common code from printRelocations() methods.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 01:47:07 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:6243-6248
+          if (R.Type == Relocation::RelType::Rel)
+            printRelocation(Obj, SecIndex, R.Rel, RelIndex, SymTab);
+          else if (R.Type == Relocation::RelType::Rela)
+            printRelocation(Obj, SecIndex, R.Rela, RelIndex, SymTab);
+          else
+            W.startLine() << W.hex(R.Relr) << "\n";
----------------
This lambda (and the identical one in `printSectionHeaders`) seems a little unfortunate to me, if I'm honest. The `printRelocationsHelper` function switches on the section header type, whilst this switches on the relocation type, which can be inferred from the section header type. Would it not be simpler to call `printRelocation` inline? I'm not sure I see how the lambda improves things.


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

https://reviews.llvm.org/D83935





More information about the llvm-commits mailing list