summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar/llvm-ar.cpp
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2019-10-16 18:39:52 +0000
committerJordan Rupprecht <rupprecht@google.com>2019-10-16 18:39:52 +0000
commita86bd22515952c184471c95aaf6273cd6a94505b (patch)
treeff315d88dd24b80e80181d53e3e749c1932488d9 /llvm/tools/llvm-ar/llvm-ar.cpp
parent87cf73e956386a0942137f70a1171c484836341b (diff)
downloadbcm5719-llvm-a86bd22515952c184471c95aaf6273cd6a94505b.tar.gz
bcm5719-llvm-a86bd22515952c184471c95aaf6273cd6a94505b.zip
[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
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
-rw-r--r--llvm/tools/llvm-ar/llvm-ar.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index 67f70e97263..70e21dfe636 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -100,6 +100,7 @@ MODIFIERS:
[b] - put [files] before [relpos] (same as [i])
[c] - do not warn if archive had to be created
[D] - use zero for timestamps and uids/gids (default)
+ [h] - display this help and exit
[i] - put [files] before [relpos] (same as [b])
[l] - ignored for compatibility
[L] - add archive's contents
@@ -112,6 +113,7 @@ MODIFIERS:
[u] - update only [files] newer than archive contents
[U] - use actual timestamps and uids/gids
[v] - be verbose about actions taken
+ [V] - display the version and exit
)";
void printHelpMessage() {
@@ -381,6 +383,12 @@ static ArchiveOperation parseCommandLine() {
case 'L':
AddLibrary = true;
break;
+ case 'V':
+ cl::PrintVersionMessage();
+ exit(0);
+ case 'h':
+ printHelpMessage();
+ exit(0);
default:
fail(std::string("unknown option ") + Options[i]);
}
@@ -1063,7 +1071,7 @@ static void runMRIScript() {
}
static bool handleGenericOption(StringRef arg) {
- if (arg == "h" || arg.startswith("-h") || arg == "--help") {
+ if (arg == "-help" || arg == "--help") {
printHelpMessage();
return true;
}
OpenPOWER on IntegriCloud