[PATCH] D70855: [llvm-readobj/llvm-readelf] - Simplify the code that dumps versions.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 01:19:25 PST 2019


jhenderson added a comment.

If you've added the ability to use the linked string table, it would be good to also have a test that successfully dumps when the sh_link points at a string table other than .dynstr to demonstrate.



================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:918-921
+        unsigned Ver = Aux.Other & ELF::VERSYM_VERSION;
+        if (Ver >= VersionMap.size())
+          VersionMap.resize(Ver + 1);
+        VersionMap[Ver] = {Aux.Name, false};
----------------
Perhaps worth pulling this code out into a small lambda, to reduce duplication, i.e. something like:

`auto InsertEntry = [&VersionMap](unsigned N, StringRef Name, bool IsVerdef) { ... }`


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

https://reviews.llvm.org/D70855





More information about the llvm-commits mailing list