mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[llvm-ar] Implement the V modifier as an alias for --version
Summary: Also update the help modifier (h) so that it works as a modifier and not just as a standalone `h`. For example, `llvm-ar h` prints the help message, but `llvm-ar xh` currently prints `unknown option h`. Reviewers: MaskRay, gbreynoo Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69007 llvm-svn: 375028
This commit is contained in:
parent
01de66076c
commit
753019aa7b
@ -1,5 +1,10 @@
|
|||||||
|
## Show that the help message for llvm-ar can be printed with either the long
|
||||||
|
## flag -help or with the h modifier.
|
||||||
|
|
||||||
# RUN: llvm-ar h | FileCheck %s
|
# RUN: llvm-ar h | FileCheck %s
|
||||||
|
# RUN: llvm-ar xh | FileCheck %s
|
||||||
# RUN: llvm-ar -h | FileCheck %s
|
# RUN: llvm-ar -h | FileCheck %s
|
||||||
|
# RUN: llvm-ar -xh | FileCheck %s
|
||||||
# RUN: llvm-ar -help | FileCheck %s
|
# RUN: llvm-ar -help | FileCheck %s
|
||||||
# RUN: llvm-ar --help | FileCheck %s
|
# RUN: llvm-ar --help | FileCheck %s
|
||||||
|
|
||||||
|
11
test/tools/llvm-ar/version.test
Normal file
11
test/tools/llvm-ar/version.test
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
## Show that the version for llvm-ar can be printed with either the long flag
|
||||||
|
## -version or with the V modifier.
|
||||||
|
|
||||||
|
RUN: llvm-ar V | FileCheck %s
|
||||||
|
RUN: llvm-ar xV | FileCheck %s
|
||||||
|
RUN: llvm-ar -V | FileCheck %s
|
||||||
|
RUN: llvm-ar -xV | FileCheck %s
|
||||||
|
RUN: llvm-ar -version | FileCheck %s
|
||||||
|
RUN: llvm-ar --version | FileCheck %s
|
||||||
|
|
||||||
|
CHECK: version
|
@ -100,6 +100,7 @@ MODIFIERS:
|
|||||||
[b] - put [files] before [relpos] (same as [i])
|
[b] - put [files] before [relpos] (same as [i])
|
||||||
[c] - do not warn if archive had to be created
|
[c] - do not warn if archive had to be created
|
||||||
[D] - use zero for timestamps and uids/gids (default)
|
[D] - use zero for timestamps and uids/gids (default)
|
||||||
|
[h] - display this help and exit
|
||||||
[i] - put [files] before [relpos] (same as [b])
|
[i] - put [files] before [relpos] (same as [b])
|
||||||
[l] - ignored for compatibility
|
[l] - ignored for compatibility
|
||||||
[L] - add archive's contents
|
[L] - add archive's contents
|
||||||
@ -112,6 +113,7 @@ MODIFIERS:
|
|||||||
[u] - update only [files] newer than archive contents
|
[u] - update only [files] newer than archive contents
|
||||||
[U] - use actual timestamps and uids/gids
|
[U] - use actual timestamps and uids/gids
|
||||||
[v] - be verbose about actions taken
|
[v] - be verbose about actions taken
|
||||||
|
[V] - display the version and exit
|
||||||
)";
|
)";
|
||||||
|
|
||||||
void printHelpMessage() {
|
void printHelpMessage() {
|
||||||
@ -381,6 +383,12 @@ static ArchiveOperation parseCommandLine() {
|
|||||||
case 'L':
|
case 'L':
|
||||||
AddLibrary = true;
|
AddLibrary = true;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
cl::PrintVersionMessage();
|
||||||
|
exit(0);
|
||||||
|
case 'h':
|
||||||
|
printHelpMessage();
|
||||||
|
exit(0);
|
||||||
default:
|
default:
|
||||||
fail(std::string("unknown option ") + Options[i]);
|
fail(std::string("unknown option ") + Options[i]);
|
||||||
}
|
}
|
||||||
@ -1063,7 +1071,7 @@ static void runMRIScript() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool handleGenericOption(StringRef arg) {
|
static bool handleGenericOption(StringRef arg) {
|
||||||
if (arg == "h" || arg.startswith("-h") || arg == "--help") {
|
if (arg == "-help" || arg == "--help") {
|
||||||
printHelpMessage();
|
printHelpMessage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user