forked from OSchip/llvm-project
[llvm-ar] Modify usage printouts to use the correct toolname
Modify llvm-ar and llvm-ranlib to use the actual name of the executable when printing the usage text via the '--help' flag. Reviewers: Maskray, jhenderson, gbreynoo Differential Revision: https://reviews.llvm.org/D124445
This commit is contained in:
parent
857eb4a152
commit
0c8c05064d
|
@ -7,9 +7,14 @@
|
|||
# RUN: ln -s llvm-ar %t/ar.exe
|
||||
# RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9
|
||||
|
||||
# RUN: llvm-ar h | FileCheck %s
|
||||
# RUN: %t/llvm-ar-9 h | FileCheck %s
|
||||
# RUN: %t/ar.exe h | FileCheck %s
|
||||
# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s
|
||||
# RUN: llvm-ar h | FileCheck %s --check-prefix=DEFAULT
|
||||
# RUN: %t/llvm-ar-9 h | FileCheck %s --check-prefix=VERSION
|
||||
# RUN: %t/ar.exe h | FileCheck %s --check-prefix=SUFFIX
|
||||
## Ensure that the "lib" substring does not result in misidentification as the
|
||||
## llvm-lib tool.
|
||||
# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s --check-prefix=ARM
|
||||
|
||||
# CHECK: USAGE: llvm-ar
|
||||
# DEFAULT: USAGE: llvm-ar{{ }}
|
||||
# VERSION: USAGE: llvm-ar-9{{ }}
|
||||
# SUFFIX: USAGE: ar{{ }}
|
||||
# ARM: USAGE: arm-pokymllib32-linux-gnueabi-llvm-ar-9{{ }}
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
# RUN: ln -s llvm-ranlib %t/llvm-ranlib-9
|
||||
# RUN: ln -s llvm-ranlib %t/ranlib.exe
|
||||
|
||||
# RUN: llvm-ranlib -h | FileCheck %s
|
||||
# RUN: %t/llvm-ranlib-9 -h | FileCheck %s
|
||||
# RUN: %t/ranlib.exe -h | FileCheck %s
|
||||
# RUN: llvm-ranlib -h | FileCheck %s --check-prefix=DEFAULT
|
||||
# RUN: %t/llvm-ranlib-9 -h | FileCheck %s --check-prefix=VERSION
|
||||
# RUN: %t/ranlib.exe -h | FileCheck %s --check-prefix=SUFFIX
|
||||
|
||||
# CHECK: USAGE: llvm-ranlib
|
||||
# DEFAULT: USAGE: llvm-ranlib{{ }}
|
||||
# VERSION: USAGE: llvm-ranlib-9{{ }}
|
||||
# SUFFIX: USAGE: ranlib{{ }}
|
||||
|
|
|
@ -62,25 +62,21 @@ static StringRef ToolName;
|
|||
// The basename of this program.
|
||||
static StringRef Stem;
|
||||
|
||||
const char RanlibHelp[] = R"(OVERVIEW: LLVM Ranlib (llvm-ranlib)
|
||||
static void printRanLibHelp(StringRef ToolName) {
|
||||
outs() << "OVERVIEW: LLVM Ranlib\n\n"
|
||||
<< "This program generates an index to speed access to archives\n\n"
|
||||
<< "USAGE: " + ToolName + " <archive-file>\n\n"
|
||||
<< "OPTIONS:\n"
|
||||
<< " -h --help - Display available options\n"
|
||||
<< " -v --version - Display the version of this program\n"
|
||||
<< " -D - Use zero for timestamps and uids/gids "
|
||||
"(default)\n"
|
||||
<< " -U - Use actual timestamps and uids/gids\n";
|
||||
}
|
||||
|
||||
This program generates an index to speed access to archives
|
||||
|
||||
USAGE: llvm-ranlib <archive-file>
|
||||
|
||||
OPTIONS:
|
||||
-h --help - Display available options
|
||||
-v --version - Display the version of this program
|
||||
-D - Use zero for timestamps and uids/gids (default)
|
||||
-U - Use actual timestamps and uids/gids
|
||||
)";
|
||||
|
||||
const char ArHelp[] = R"(OVERVIEW: LLVM Archiver
|
||||
|
||||
USAGE: llvm-ar [options] [-]<operation>[modifiers] [relpos] [count] <archive> [files]
|
||||
llvm-ar -M [<mri-script]
|
||||
|
||||
OPTIONS:
|
||||
static void printArHelp(StringRef ToolName) {
|
||||
const char ArOptions[] =
|
||||
R"(OPTIONS:
|
||||
--format - archive format to create
|
||||
=default - default
|
||||
=gnu - gnu
|
||||
|
@ -127,11 +123,20 @@ MODIFIERS:
|
|||
[V] - display the version and exit
|
||||
)";
|
||||
|
||||
outs() << "OVERVIEW: LLVM Archiver\n\n"
|
||||
<< "USAGE: " + ToolName +
|
||||
" [options] [-]<operation>[modifiers] [relpos] "
|
||||
"[count] <archive> [files]\n"
|
||||
<< " " + ToolName + " -M [<mri-script]\n\n";
|
||||
|
||||
outs() << ArOptions;
|
||||
}
|
||||
|
||||
static void printHelpMessage() {
|
||||
if (Stem.contains_insensitive("ranlib"))
|
||||
outs() << RanlibHelp;
|
||||
printRanLibHelp(Stem);
|
||||
else if (Stem.contains_insensitive("ar"))
|
||||
outs() << ArHelp;
|
||||
printArHelp(Stem);
|
||||
}
|
||||
|
||||
static unsigned MRILineNumber;
|
||||
|
|
Loading…
Reference in New Issue