Skip to content

Commit beb2493

Browse files
committed
[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 llvm-svn: 364029
1 parent d5cf95e commit beb2493

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

llvm/test/Support/check-default-options.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22
# RUN: llvm-readobj --help-hidden %t | FileCheck --check-prefix=CHECK-READOBJ %s
33
# RUN: llvm-tblgen --help-hidden %t | FileCheck --check-prefix=CHECK-TBLGEN %s
44
# RUN: llvm-opt-report --help-hidden %t | FileCheck --check-prefix=CHECK-OPT-RPT %s
5-
# RUN: llvm-dwarfdump --help-hidden %t | FileCheck --check-prefix=CHECK-DWARF %s
6-
# RUN: llvm-dwarfdump -h %t | FileCheck --check-prefix=CHECK-DWARF-H %s
7-
85

96
# CHECK-OBJDUMP: -h - Alias for --section-headers
107
# CHECK-READOBJ: -h - Alias for --file-headers
118
# CHECK-TBLGEN: -h - Alias for --help
129
# CHECK-OPT-RPT: -h - Alias for --help
13-
# CHECK-DWARF: -h - Alias for -help
14-
15-
# llvm-dwarfdump declares `-h` option and prints special help in that case,
16-
# which is weird, but makes for a good test, i.e., shows the default `-h`
17-
# wasn't used.
18-
# CHECK-DWARF-H-NOT: --help-list - Display list of available options (--help-list-hidden for more)

llvm/test/tools/llvm-dwarfdump/cmdline.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ RUN: llvm-dwarfdump --help 2>&1 | FileCheck --check-prefix=HELP %s --implicit-ch
33
HELP: USAGE: llvm-dwarfdump{{[^ ]*}} [options] <input object files or .dSYM bundles>
44
HELP: Color Options
55
HELP: -color
6+
HELP: Generic Options
7+
HELP: -help
8+
HELP: -help-list
9+
HELP: -version
610
HELP: Section-specific Dump Options
711
HELP: -debug-info - Dump the .debug_info section
812
HELP: -eh-frame

llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ namespace {
9292
using namespace cl;
9393

9494
OptionCategory DwarfDumpCategory("Specific Options");
95-
static opt<bool> Help("h", desc("Alias for -help"), Hidden,
96-
cat(DwarfDumpCategory));
9795
static list<std::string>
9896
InputFilenames(Positional, desc("<input object files or .dSYM bundles>"),
9997
ZeroOrMore, cat(DwarfDumpCategory));
@@ -575,11 +573,6 @@ int main(int argc, char **argv) {
575573
"pretty-print DWARF debug information in object files"
576574
" and debug info archives.\n");
577575

578-
if (Help) {
579-
PrintHelpMessage(/*Hidden =*/false, /*Categorized =*/true);
580-
return 0;
581-
}
582-
583576
// FIXME: Audit interactions between these two options and make them
584577
// compatible.
585578
if (Diff && Verbose) {

0 commit comments

Comments
 (0)