[llvm] 3f9004c - [llvm-readelf/llvm-readobj] Remove one-dash long options

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 12:03:14 PDT 2021


Author: Fangrui Song
Date: 2021-07-16T12:03:08-07:00
New Revision: 3f9004c19c9b790afa58bc5ae22e9c854d2afed0

URL: https://github.com/llvm/llvm-project/commit/3f9004c19c9b790afa58bc5ae22e9c854d2afed0
DIFF: https://github.com/llvm/llvm-project/commit/3f9004c19c9b790afa58bc5ae22e9c854d2afed0.diff

LOG: [llvm-readelf/llvm-readobj] Remove one-dash long options

llvm-readelf is a user-facing tool which emulates GNU readelf. Remove one-dash
long options which are not recognized by GNU style `getopt_long`. This ensures
long options cannot collide with grouped short options.

Note: the documentation (D63719)/help messages have recommended the double-dash
forms since LLVM 9.0.0.
llvm-readobj is intended as an internal tool which has some flexibility.
llvm-readelf/llvm-readobj use the same option parsing code and llvm-readobj's
one-dash long options aren't used after test migration.

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

Added: 
    

Modified: 
    llvm/tools/llvm-readobj/Opts.td

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-readobj/Opts.td b/llvm/tools/llvm-readobj/Opts.td
index 82ae56793e39d..493b93769eb4d 100644
--- a/llvm/tools/llvm-readobj/Opts.td
+++ b/llvm/tools/llvm-readobj/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 addrsig : FF<"addrsig", "Display address-significance table">;


        


More information about the llvm-commits mailing list