[Lldb-commits] [PATCH] D80226: [lldb/Driver] Error out when encountering unknown arguments
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 20 09:49:56 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b5b81bcdccb: [lldb/Driver] Error out when encountering unknown arguments (authored by JDevlieghere).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80226/new/
https://reviews.llvm.org/D80226
Files:
lldb/test/Shell/Driver/TestPositionalArgs.test
lldb/tools/driver/Driver.cpp
Index: lldb/tools/driver/Driver.cpp
===================================================================
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -856,9 +856,12 @@
return 0;
}
- for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
- WithColor::warning() << "ignoring unknown option: " << arg->getSpelling()
- << '\n';
+ // Error out on unknown options.
+ if (input_args.hasArg(OPT_UNKNOWN)) {
+ for (auto *arg : input_args.filtered(OPT_UNKNOWN)) {
+ WithColor::error() << "unknown option: " << arg->getSpelling() << '\n';
+ }
+ return 1;
}
if (auto exit_code = InitializeReproducer(input_args)) {
Index: lldb/test/Shell/Driver/TestPositionalArgs.test
===================================================================
--- lldb/test/Shell/Driver/TestPositionalArgs.test
+++ lldb/test/Shell/Driver/TestPositionalArgs.test
@@ -23,10 +23,8 @@
DASH: Current executable set to {{.*}}foo
DASH: target.run-args "bar" "-baz" "--quux"
-RUN: %lldb -x -b %t.foo bar -baz --quux 2>&1 | FileCheck %s --check-prefix UNKNOWN
-RUN: %lldb -x -b -f %t.foo bar -baz --quux 2>&1 | FileCheck %s --check-prefix UNKNOWN
+RUN: not %lldb -x -b %t.foo bar -baz --quux 2>&1 | FileCheck %s --check-prefix UNKNOWN
+RUN: not %lldb -x -b -f %t.foo bar -baz --quux 2>&1 | FileCheck %s --check-prefix UNKNOWN
-UNKNOWN: warning: ignoring unknown option: -baz
-UNKNOWN: warning: ignoring unknown option: --quux
-UNKNOWN: Current executable set to {{.*}}foo
-UNKNOWN: target.run-args "bar"
+UNKNOWN: error: unknown option: -baz
+UNKNOWN: error: unknown option: --quux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80226.265285.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200520/1e376459/attachment.bin>
More information about the lldb-commits
mailing list