[llvm] 96e9bc4 - [llvm-nm] Remove one-dash long options except -arch

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 09:50:45 PDT 2021


Author: Fangrui Song
Date: 2021-07-15T09:50:37-07:00
New Revision: 96e9bc42447531a20569e0a680c029837a4868d8

URL: https://github.com/llvm/llvm-project/commit/96e9bc42447531a20569e0a680c029837a4868d8
DIFF: https://github.com/llvm/llvm-project/commit/96e9bc42447531a20569e0a680c029837a4868d8.diff

LOG: [llvm-nm] Remove one-dash long options except -arch

The documentation and help messages have recommended the double-dash forms for
quite a while. Remove one-dash long options which are not recognized by GNU
style `getopt_long`.

`-arch` is kept as it is in the manpage of classic nm
https://keith.github.io/xcode-man-pages/nm.1.html

Note: the dyldinfo related options don't have a test.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D105948

Added: 
    

Modified: 
    llvm/test/tools/llvm-nm/X86/posix-aliases.test
    llvm/tools/llvm-nm/Opts.td

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-nm/X86/posix-aliases.test b/llvm/test/tools/llvm-nm/X86/posix-aliases.test
index 71b05e507fbf7..78b1b21de1c7a 100644
--- a/llvm/test/tools/llvm-nm/X86/posix-aliases.test
+++ b/llvm/test/tools/llvm-nm/X86/posix-aliases.test
@@ -1,5 +1,5 @@
 # RUN: llvm-nm -P %p/Inputs/hello.obj.elf-x86_64 > %t1
 # RUN: llvm-nm --format=posix %p/Inputs/hello.obj.elf-x86_64 > %t2
-# RUN: llvm-nm -portability %p/Inputs/hello.obj.elf-x86_64 > %t3
+# RUN: llvm-nm --portability %p/Inputs/hello.obj.elf-x86_64 > %t3
 # RUN: 
diff  %t1 %t2
 # RUN: 
diff  %t1 %t3

diff  --git a/llvm/tools/llvm-nm/Opts.td b/llvm/tools/llvm-nm/Opts.td
index 649fe7a9b67f6..3a790890909ad 100644
--- a/llvm/tools/llvm-nm/Opts.td
+++ b/llvm/tools/llvm-nm/Opts.td
@@ -1,17 +1,16 @@
 include "llvm/Option/OptParser.td"
 
 class F<string letter, string help> : Flag<["-"], letter>, HelpText<help>;
-class FF<string name, string help> : Flag<["--", "-"], name>, HelpText<help>;
+class FF<string name, string help> : Flag<["--"], name>, HelpText<help>;
 
 multiclass BB<string name, string help1, string help2> {
-  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
-  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
+  def NAME: Flag<["--"], name>, HelpText<help1>;
+  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
 }
 
 multiclass Eq<string name, string help> {
-  def NAME #_EQ : Joined<["--", "-"], name #"=">,
-                  HelpText<help>;
-  def : Separate<["--", "-"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
+  def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>;
+  def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
 }
 
 def debug_syms : FF<"debug-syms", "Show all symbols, even debugger only">;
@@ -42,7 +41,8 @@ def grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-nm Mach-O Specific Options"
 
 def add_dyldinfo : FF<"add-dyldinfo", "Add symbols from the dyldinfo not already in the symbol table">, Group<grp_mach_o>;
 def add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group<grp_mach_o>;
-defm arch : Eq<"arch", "architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
+def arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
+def : Separate<["--", "-"], "arch">, Alias<arch_EQ>;
 def dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group<grp_mach_o>;
 def no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group<grp_mach_o>;
 def s : F<"s", "Dump only symbols from this segment and section name">, Group<grp_mach_o>;


        


More information about the llvm-commits mailing list