[PATCH] D94907: [llvm-nm][ELF] - Make -D display symbol versions.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 02:26:17 PST 2021


grimar added inline comments.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1718-1719
+  std::vector<std::string> Ret;
+  size_t I = 0;
+  for (BasicSymbolRef Sym : Symbols) {
+    ++I;
----------------
jhenderson wrote:
> Seems like if you're not using `Sym`, this should be an older style `for` loop?
Done. Unfortunately I can't take `size()`, because `Symbols` is `ELFObjectFileBase::elf_symbol_iterator_range`.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1788
   if (!(MachO && DyldInfoOnly)) {
+    size_t I = (size_t)-1;
     for (BasicSymbolRef Sym : Symbols) {
----------------
jhenderson wrote:
> Is the case actually necessary? I'm sure I've seen `size_t X = -1` in other places before without warnings.
Yeah, looks like it is not needed.


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

https://reviews.llvm.org/D94907



More information about the llvm-commits mailing list