From: Nico Weber Date: Fri, 5 Jul 2019 12:31:32 +0000 (+0000) Subject: lld, llvm-dlltool, llvm-lib: Use getAsString() instead of getSpelling() for printing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=67c80aa9b052e345bfc607b04d4a31ca264360b3;p=llvm 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 --- diff --git a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp index f894211b644..0b406cc531a 100644 --- a/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -108,7 +108,8 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef 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"; diff --git a/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 1201b2809c3..18ab6637305 100644 --- a/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -163,7 +163,8 @@ int llvm::libDriverMain(ArrayRef 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)) {