1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[llvm-ar] Parse 'h' and '-h': display help and exit

Support `llvm-ar h` and `llvm-ar -h` because they may be what users try
at first. Note, operation 'h' is undocumented in GNU ar.

Reviewed By: jhenderson

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

llvm-svn: 372088
This commit is contained in:
Fangrui Song 2019-09-17 09:25:52 +00:00
parent 56a1935729
commit 590f84d84c
2 changed files with 11 additions and 5 deletions

View File

@ -0,0 +1,6 @@
# RUN: llvm-ar h | FileCheck %s
# RUN: llvm-ar -h | FileCheck %s
# RUN: llvm-ar -help | FileCheck %s
# RUN: llvm-ar --help | FileCheck %s
# CHECK: USAGE: llvm-ar

View File

@ -70,14 +70,14 @@ USAGE: llvm-ar [options] [-]<operation>[modifiers] [relpos] [count] <archive> [f
llvm-ar -M [<mri-script]
OPTIONS:
--format - Archive format to create
--format - archive format to create
=default - default
=gnu - gnu
=darwin - darwin
=bsd - bsd
--plugin=<string> - Ignored for compatibility
--help - Display available options
--version - Display the version of this program
--plugin=<string> - ignored for compatibility
-h --help - display this help and exit
--version - print the version and exit
@<file> - read options from <file>
OPERATIONS:
@ -1030,7 +1030,7 @@ static void runMRIScript() {
}
static bool handleGenericOption(StringRef arg) {
if (arg == "-help" || arg == "--help") {
if (arg == "h" || arg.startswith("-h") || arg == "--help") {
printHelpMessage();
return true;
}