[llvm] 2974b3c - [llvm-dwarfdump] Make commandline arguments consistent.

Xing GUO via llvm-commits llvm-commits at lists.llvm.org
Thu May 14 02:34:50 PDT 2020


Author: Xing GUO
Date: 2020-05-14T17:34:50+08:00
New Revision: 2974b3c566d68f1d7c907f891137cf0292dd35aa

URL: https://github.com/llvm/llvm-project/commit/2974b3c566d68f1d7c907f891137cf0292dd35aa
DIFF: https://github.com/llvm/llvm-project/commit/2974b3c566d68f1d7c907f891137cf0292dd35aa.diff

LOG: [llvm-dwarfdump] Make commandline arguments consistent.

Currently, llvm-dwarfdump's help message has two issues.

1. Most long options are printed in `--long-option`, except for some section dumping options, e.g., `-apple-names`, `-debug-addr`.

2. Most options are printed with consistent indention, except for some section dumping options.

This patch helps resolve these two issues.

Reviewed By: jhenderson

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

Added: 
    

Modified: 
    llvm/test/tools/llvm-dwarfdump/cmdline.test
    llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-dwarfdump/cmdline.test b/llvm/test/tools/llvm-dwarfdump/cmdline.test
index 5930e7188507..e6ac1c264617 100644
--- a/llvm/test/tools/llvm-dwarfdump/cmdline.test
+++ b/llvm/test/tools/llvm-dwarfdump/cmdline.test
@@ -2,29 +2,29 @@ RUN: llvm-dwarfdump -h 2>&1 | FileCheck --check-prefix=HELP %s --implicit-check-
 RUN: llvm-dwarfdump --help 2>&1 | FileCheck --check-prefix=HELP %s --implicit-check-not=out-file
 HELP: USAGE: llvm-dwarfdump{{[^ ]*}} [options] <input object files or .dSYM bundles>
 HELP: Color Options
-HELP: -color
+HELP: --color
 HELP: Generic Options
-HELP: -help
-HELP: -help-list
-HELP: -version
+HELP: --help
+HELP: --help-list
+HELP: --version
 HELP: Section-specific Dump Options
-HELP: -debug-info            - Dump the .debug_info section
-HELP: -eh-frame
+HELP: --debug-info            - Dump the .debug_info section
+HELP: --eh-frame
 HELP: Specific Options
-HELP: -
diff 
-HELP: -find
-HELP: -ignore-case
-HELP: -lookup
-HELP: -name
+HELP: --
diff 
+HELP: --find
+HELP: --ignore-case
+HELP: --lookup
+HELP: --name
 HELP: -o=<filename>
-HELP: -parent-recurse-depth=<N>
-HELP: -recurse-depth=<N>
-HELP: -regex
-HELP: -show-children
-HELP: -show-form
-HELP: -show-parents
-HELP: -statistics
-HELP: -summarize-types
+HELP: --parent-recurse-depth=<N>
+HELP: --recurse-depth=<N>
+HELP: --regex
+HELP: --show-children
+HELP: --show-form
+HELP: --show-parents
+HELP: --statistics
+HELP: --summarize-types
 HELP: @FILE
 
 RUN: llvm-dwarfdump --version 2>&1 | FileCheck --check-prefix=VERSION %s

diff  --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 9cae4dc3d5b3..b537ac5582ae 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -72,10 +72,7 @@ class parser<OffsetOption> final : public basic_parser<OffsetOption> {
     return ValueOptional;
   }
 
-  void printOptionInfo(const Option &O, size_t GlobalWidth) const {
-    outs() << "  -" << O.ArgStr;
-    Option::printHelpStr(O.HelpStr, GlobalWidth, getOptionWidth(O));
-  }
+  StringRef getValueName() const override { return StringRef(); }
 
   void printOptionDiff(const Option &O, OffsetOption V, OptVal Default,
                        size_t GlobalWidth) const {


        


More information about the llvm-commits mailing list