[PATCH] D116977: [llvm-ar] Enforce one-dash form for long options
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 12 11:33:31 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24e7371fef0d: [llvm-ar] Enforce one-dash form for long options (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116977/new/
https://reviews.llvm.org/D116977
Files:
llvm/test/Object/archive-format.test
llvm/test/tools/llvm-ar/plugin.test
llvm/test/tools/llvm-ar/response.test
llvm/test/tools/llvm-ar/version.test
llvm/tools/llvm-ar/llvm-ar.cpp
Index: llvm/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/tools/llvm-ar/llvm-ar.cpp
+++ llvm/tools/llvm-ar/llvm-ar.cpp
@@ -1111,11 +1111,11 @@
}
static bool handleGenericOption(StringRef arg) {
- if (arg == "-help" || arg == "--help" || arg == "-h") {
+ if (arg == "--help" || arg == "-h") {
printHelpMessage();
return true;
}
- if (arg == "-version" || arg == "--version") {
+ if (arg == "--version") {
cl::PrintVersionMessage();
return true;
}
@@ -1129,8 +1129,6 @@
if (Arg.startswith("--"))
Arg = Arg.substr(2);
- else if (Arg.startswith("-"))
- Arg = Arg.substr(1);
size_t len = Expected.size();
if (Arg == Expected) {
Index: llvm/test/tools/llvm-ar/version.test
===================================================================
--- llvm/test/tools/llvm-ar/version.test
+++ llvm/test/tools/llvm-ar/version.test
@@ -5,7 +5,10 @@
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
+
+RUN: not llvm-ar -version 2>&1 | FileCheck %s --check-prefix=ONE-DASH
+
+ONE-DASH: error: unknown option e
Index: llvm/test/tools/llvm-ar/response.test
===================================================================
--- llvm/test/tools/llvm-ar/response.test
+++ llvm/test/tools/llvm-ar/response.test
@@ -36,6 +36,6 @@
# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=WIN
# WIN: error: blah\foo: [[MSG]]
-# RUN: not llvm-ar -rsp-quoting posix @%t-rsp.txt 2>&1 | \
+# RUN: not llvm-ar --rsp-quoting posix @%t-rsp.txt 2>&1 | \
# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=POSIX
# POSIX: error: blahfoo: [[MSG]]
Index: llvm/test/tools/llvm-ar/plugin.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ar/plugin.test
@@ -0,0 +1,9 @@
+## Test that --plugin is ignored.
+
+# RUN: rm -f %t.a
+# RUN: touch %t.txt
+# RUN: llvm-ar rc %t.a %t.txt
+# RUN: llvm-ar --plugin ignore t %t.a | FileCheck %s
+# RUN: llvm-ar t --plugin=ignore %t.a | FileCheck %s
+
+# CHECK: {{.*}}.txt
Index: llvm/test/Object/archive-format.test
===================================================================
--- llvm/test/Object/archive-format.test
+++ llvm/test/Object/archive-format.test
@@ -89,3 +89,6 @@
SOLARIS: !<arch>
SOLARIS-NEXT: / 0 0 0 0 8 `
SOLARIS-NEXT: ^@^@^@^@^@^@^@^@foo.o/
+
+RUN: not llvm-ar -format=gnu rc %t.a 0123456789abcde 2>&1 | FileCheck --check-prefix=ONE-DASH %s
+ONE-DASH: error: unknown option f
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116977.399397.patch
Type: text/x-patch
Size: 2681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220112/30acc11a/attachment.bin>
More information about the llvm-commits
mailing list