[PATCH] D67998: [llvm-readobj/llvm-readelf]: Dump stack-size entry for all function symbols that have a particular value (fixes PR43245)

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 01:55:15 PDT 2019


grimar added inline comments.


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:4749
+    printStackSizeEntry(StackSize, FuncName);
+  }
 }
----------------
grimar wrote:
> Perhaps inline `FuncName`? It would remove one string assignment for the normal case:
> 
> ```
>   for (const SymbolRef &FuncSym : FuncSyms) {
>     // A valid SymbolRef has a non-null object file pointer.
>     if (FuncSym.BasicSymbolRef::getObject()) {
>       // Extract the symbol name.
>       Expected<StringRef> FuncNameOrErr = FuncSym.getName();
>       if (FuncNameOrErr)
>         printStackSizeEntry(StackSize, maybeDemangle(*FuncNameOrErr));
>       else
>         consumeError(FuncNameOrErr.takeError());
>       continue;
>     }
>     reportWarning(
>         createError("could not identify function symbol for stack size entry"),
>         Obj->getFileName());
>     printStackSizeEntry(StackSize, "?");
>   }
> ```
Ah, my suggestion will not work for a case when `getName()` returns an error. Please ignore this comment.


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

https://reviews.llvm.org/D67998





More information about the llvm-commits mailing list