[PATCH] D81907: [llvm-objcopy] Fix help text

Sameer Arora via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 07:42:52 PDT 2020


sameerarora101 marked an inline comment as done.
sameerarora101 added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/CopyConfig.cpp:398
                       StringRef ToolName) {
-  OptTable.PrintHelp(OS, (ToolName + " input [output]").str().c_str(),
+  StringRef Output = ToolName == "llvm-install-name-tool" ? "" : " [output]";
+  OptTable.PrintHelp(OS, (ToolName + " input" + Output).str().c_str(),
----------------
jhenderson wrote:
> Rather than relying on a string for the name, I wonder if this code would be more robust with an enum that represents the three different tools, given that there's always potential for more front ends to be added. You would probably still want to pass in the tool name, but that could just be whatever the executable is called, possibly. For example, if the tool was llvm_install_name_tool, it would print that as the name in the help text message, rather than the current llvm-install-name-tool.
So I made a small enum and passed the appropriate enum types at the various function calls to `printHelp`. Does this work?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81907





More information about the llvm-commits mailing list