forked from OSchip/llvm-project
[lldb/Driver] Error out when encountering unknown arguments
There appears to be consensus in D80165 that this is the desired behavior and I personally agree. Differential revision: https://reviews.llvm.org/D80226
This commit is contained in:
parent
c14699570d
commit
5b5b81bcdc
|
@ -23,10 +23,8 @@ RUN: %lldb -x -b -f %t.foo -- bar -baz --quux | FileCheck %s --check-prefix DASH
|
|||
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
|
||||
|
|
|
@ -856,9 +856,12 @@ int main(int argc, char const *argv[]) {
|
|||
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)) {
|
||||
|
|
Loading…
Reference in New Issue