From 5aac6f60bce64b4570a646210a43e3274b65e1ef Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 15 Jul 2021 09:50:37 -0700 Subject: [PATCH] [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 --- test/tools/llvm-nm/X86/posix-aliases.test | 2 +- tools/llvm-nm/Opts.td | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/tools/llvm-nm/X86/posix-aliases.test b/test/tools/llvm-nm/X86/posix-aliases.test index 71b05e507fb..78b1b21de1c 100644 --- a/test/tools/llvm-nm/X86/posix-aliases.test +++ b/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/tools/llvm-nm/Opts.td b/tools/llvm-nm/Opts.td index 649fe7a9b67..3a790890909 100644 --- a/tools/llvm-nm/Opts.td +++ b/tools/llvm-nm/Opts.td @@ -1,17 +1,16 @@ include "llvm/Option/OptParser.td" class F : Flag<["-"], letter>, HelpText; -class FF : Flag<["--", "-"], name>, HelpText; +class FF : Flag<["--"], name>, HelpText; multiclass BB { - def NAME: Flag<["--", "-"], name>, HelpText; - def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText; + def NAME: Flag<["--"], name>, HelpText; + def no_ # NAME: Flag<["--"], "no-" # name>, HelpText; } multiclass Eq { - def NAME #_EQ : Joined<["--", "-"], name #"=">, - HelpText; - def : Separate<["--", "-"], name>, Alias(NAME #_EQ)>; + def NAME #_EQ : Joined<["--"], name #"=">, HelpText; + def : Separate<["--"], name>, Alias(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; def add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group; -defm arch : Eq<"arch", "architecture(s) from a Mach-O file to dump">, Group; +def arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group; +def : Separate<["--", "-"], "arch">, Alias; def dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group; def no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group; def s : F<"s", "Dump only symbols from this segment and section name">, Group;