[llvm] r364029 - [llvm-dwarfdump] Remove unnecessary explicit -h behaviour

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 04:22:21 PDT 2019


Author: jhenderson
Date: Fri Jun 21 04:22:20 2019
New Revision: 364029

URL: http://llvm.org/viewvc/llvm-project?rev=364029&view=rev
Log:
[llvm-dwarfdump] Remove unnecessary explicit -h behaviour

--help and -h are automatically supported by the command-line parser,
unless overridden by the tool. The behaviour of the PrintHelpMessage
being used for -h prior to this patch is subtly different to that
provided by --help automatically (it omits certain elements of help text
and options, such as --help-list), so overriding the default is not
desirable, without good reason. This patch removes the explicit
specification of -h and its behaviour, so that the default behaviour is
used.

Reviewed by: hintonda

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

Modified:
    llvm/trunk/test/Support/check-default-options.txt
    llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test
    llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Modified: llvm/trunk/test/Support/check-default-options.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Support/check-default-options.txt?rev=364029&r1=364028&r2=364029&view=diff
==============================================================================
--- llvm/trunk/test/Support/check-default-options.txt (original)
+++ llvm/trunk/test/Support/check-default-options.txt Fri Jun 21 04:22:20 2019
@@ -2,17 +2,8 @@
 # RUN: llvm-readobj --help-hidden %t | FileCheck --check-prefix=CHECK-READOBJ %s
 # RUN: llvm-tblgen --help-hidden %t | FileCheck --check-prefix=CHECK-TBLGEN %s
 # RUN: llvm-opt-report --help-hidden %t | FileCheck --check-prefix=CHECK-OPT-RPT %s
-# RUN: llvm-dwarfdump --help-hidden %t | FileCheck --check-prefix=CHECK-DWARF %s
-# RUN: llvm-dwarfdump -h %t | FileCheck --check-prefix=CHECK-DWARF-H %s
-
 
 # CHECK-OBJDUMP: -h  - Alias for --section-headers
 # CHECK-READOBJ: -h  - Alias for --file-headers
 # CHECK-TBLGEN:  -h  - Alias for --help
 # CHECK-OPT-RPT: -h  - Alias for --help
-# CHECK-DWARF:   -h  - Alias for -help
-
-# llvm-dwarfdump declares `-h` option and prints special help in that case,
-# which is weird, but makes for a good test, i.e., shows the default `-h`
-# wasn't used.
-# CHECK-DWARF-H-NOT: --help-list  - Display list of available options (--help-list-hidden for more)

Modified: llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test?rev=364029&r1=364028&r2=364029&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test Fri Jun 21 04:22:20 2019
@@ -3,6 +3,10 @@ RUN: llvm-dwarfdump --help 2>&1 | FileCh
 HELP: USAGE: llvm-dwarfdump{{[^ ]*}} [options] <input object files or .dSYM bundles>
 HELP: Color Options
 HELP: -color
+HELP: Generic Options
+HELP: -help
+HELP: -help-list
+HELP: -version
 HELP: Section-specific Dump Options
 HELP: -debug-info            - Dump the .debug_info section
 HELP: -eh-frame

Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=364029&r1=364028&r2=364029&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Fri Jun 21 04:22:20 2019
@@ -92,8 +92,6 @@ namespace {
 using namespace cl;
 
 OptionCategory DwarfDumpCategory("Specific Options");
-static opt<bool> Help("h", desc("Alias for -help"), Hidden,
-                      cat(DwarfDumpCategory));
 static list<std::string>
     InputFilenames(Positional, desc("<input object files or .dSYM bundles>"),
                    ZeroOrMore, cat(DwarfDumpCategory));
@@ -575,11 +573,6 @@ int main(int argc, char **argv) {
       "pretty-print DWARF debug information in object files"
       " and debug info archives.\n");
 
-  if (Help) {
-    PrintHelpMessage(/*Hidden =*/false, /*Categorized =*/true);
-    return 0;
-  }
-
   // FIXME: Audit interactions between these two options and make them
   //        compatible.
   if (Diff && Verbose) {




More information about the llvm-commits mailing list