lld, llvm-dlltool, llvm-lib: Use getAsString() instead of getSpelling() for printing unknown args

Since OPT_UNKNOWN args never have any values and consist only of
spelling (and are never aliased), this doesn't make any difference in
practice, but it's more consistent with Arg's guidance to use
getAsString() for diagnostics, and it matches what clang does.

Also tweak two tests to use an unknown option that contains '=' for
additional coverage while here. (The new tests pass fine with the old
code too though.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nico Weber 2019-07-05 12:31:32 +00:00
parent a71113c59d
commit 67c80aa9b0
2 changed files with 4 additions and 2 deletions

View File

@ -108,7 +108,8 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
}
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n";
llvm::errs() << "ignoring unknown argument: " << Arg->getAsString(Args)
<< "\n";
if (!Args.hasArg(OPT_d)) {
llvm::errs() << "no definition file specified\n";

View File

@ -163,7 +163,8 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
return 1;
}
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n";
llvm::errs() << "ignoring unknown argument: " << Arg->getAsString(Args)
<< "\n";
// Handle /help
if (Args.hasArg(OPT_help)) {