[clang] 8c2c622 - [Driver] Refactor err_drv_unsupported_option_argument call sites to use llvm::opt::Arg::getSpelling
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 8 14:39:16 PST 2022
Author: Fangrui Song
Date: 2022-11-08T14:39:09-08:00
New Revision: 8c2c62282fca2f3dbfa338427aa97f702e67f86b
URL: https://github.com/llvm/llvm-project/commit/8c2c62282fca2f3dbfa338427aa97f702e67f86b
DIFF: https://github.com/llvm/llvm-project/commit/8c2c62282fca2f3dbfa338427aa97f702e67f86b.diff
LOG: [Driver] Refactor err_drv_unsupported_option_argument call sites to use llvm::opt::Arg::getSpelling
For `-foo=bar`, getSpelling return `-foo=` which is exactly what we need from
the diagnostic. Drop `-` from the err_drv_unsupported_option_argument template.
This change makes `--` long option diagnostics more convenient.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D137659
Added:
Modified:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/Driver.cpp
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/lib/Driver/ToolChains/Arch/Mips.cpp
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/Flang.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/lib/Driver/ToolChains/Hexagon.cpp
clang/lib/Driver/ToolChains/MSP430.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/mingw-cfguard.c
flang/lib/Frontend/CompilerInvocation.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 44c277b3c3d8..12c246b32cfd 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -19,7 +19,7 @@ def err_drv_unsupported_opt_for_target : Error<
def err_drv_unsupported_opt_for_language_mode : Error<
"unsupported option '%0' for language mode '%1'">;
def err_drv_unsupported_option_argument : Error<
- "unsupported argument '%1' to option '-%0'">;
+ "unsupported argument '%1' to option '%0'">;
def err_drv_unknown_stdin_type : Error<
"-E or -x required when input is from standard input">;
def err_drv_unknown_stdin_type_clang_cl : Error<
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 27e15b983db6..a45c9e7f4957 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -703,7 +703,7 @@ static driver::LTOKind parseLTOMode(Driver &D, const llvm::opt::ArgList &Args,
if (LTOMode == LTOK_Unknown) {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << A->getValue();
+ << A->getSpelling() << A->getValue();
return LTOK_None;
}
return LTOMode;
@@ -735,7 +735,7 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
if (RT == OMPRT_Unknown) {
if (A)
Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << A->getValue();
+ << A->getSpelling() << A->getValue();
else
// FIXME: We could use a nicer diagnostic here.
Diag(diag::err_drv_unsupported_opt) << "-fopenmp";
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index a710081fa2d4..e88cfaed1c4e 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -249,7 +249,7 @@ static SanitizerMask parseSanitizeTrapArgs(const Driver &D,
SanitizerSet S;
S.Mask = InvalidValues;
D.Diag(diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << toString(S);
+ << Arg->getSpelling() << toString(S);
}
TrappingKinds |= expandSanitizerGroups(Add) & ~TrapRemove;
} else if (Arg->getOption().matches(options::OPT_fno_sanitize_trap_EQ)) {
@@ -604,7 +604,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
SetToDiagnose.Mask |= KindsToDiagnose;
if (DiagnoseErrors)
D.Diag(diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << toString(SetToDiagnose);
+ << Arg->getSpelling() << toString(SetToDiagnose);
DiagnosedUnrecoverableKinds |= KindsToDiagnose;
}
RecoverableKinds |= expandSanitizerGroups(Add);
@@ -619,7 +619,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
SetToDiagnose.Mask |= KindsToDiagnose;
if (DiagnoseErrors)
D.Diag(diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << toString(SetToDiagnose);
+ << Arg->getSpelling() << toString(SetToDiagnose);
DiagnosedAlwaysRecoverableKinds |= KindsToDiagnose;
}
RecoverableKinds &= ~expandSanitizerGroups(Remove);
@@ -951,7 +951,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
auto parsedAsanDtorKind = AsanDtorKindFromString(Arg->getValue());
if (parsedAsanDtorKind == llvm::AsanDtorKind::Invalid && DiagnoseErrors) {
TC.getDriver().Diag(clang::diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << Arg->getValue();
+ << Arg->getSpelling() << Arg->getValue();
}
AsanDtorKind = parsedAsanDtorKind;
}
@@ -964,7 +964,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
llvm::AsanDetectStackUseAfterReturnMode::Invalid &&
DiagnoseErrors) {
TC.getDriver().Diag(clang::diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << Arg->getValue();
+ << Arg->getSpelling() << Arg->getValue();
}
AsanUseAfterReturn = parsedAsanUseAfterReturn;
}
@@ -1346,7 +1346,7 @@ SanitizerMask parseArgValues(const Driver &D, const llvm::opt::Arg *A,
Kinds |= Kind;
else if (DiagnoseErrors)
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
return Kinds;
}
@@ -1381,7 +1381,7 @@ int parseCoverageFeatures(const Driver &D, const llvm::opt::Arg *A,
.Default(0);
if (F == 0 && DiagnoseErrors)
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
Features |= F;
}
return Features;
@@ -1403,7 +1403,7 @@ int parseBinaryMetadataFeatures(const Driver &D, const llvm::opt::Arg *A,
.Default(0);
if (F == 0 && DiagnoseErrors)
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
Features |= F;
}
return Features;
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 514db4ca4f7e..87bb7c558555 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -274,9 +274,9 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
// If "-Wa,-march=" is used, 'WaMArch' will contain the argument's value,
// while 'A' is uninitialized. Only dereference 'A' in the other case.
if (!WaMArch.empty())
- Diag << "march=" << WaMArch;
+ Diag << "-march=" << WaMArch;
else
- Diag << A->getOption().getName() << A->getValue();
+ Diag << A->getSpelling() << A->getValue();
}
if (Args.getLastArg(options::OPT_mgeneral_regs_only)) {
@@ -330,7 +330,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
continue;
}
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Scope;
+ << A->getSpelling() << Scope;
break;
}
}
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index 5b3f7c17c307..67dec7cadada 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -122,7 +122,7 @@ static void checkARMArchName(const Driver &D, const Arg *A, const ArgList &Args,
(Split.second.size() && !DecodeARMFeatures(D, Split.second, CPUName,
ArchKind, Features, ArgFPUID)))
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << A->getValue();
+ << A->getSpelling() << A->getValue();
}
// Check -mcpu=. Needs ArchName to handle -mcpu=generic.
@@ -139,7 +139,7 @@ static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
(Split.second.size() &&
!DecodeARMFeatures(D, Split.second, CPU, ArchKind, Features, ArgFPUID)))
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << A->getValue();
+ << A->getSpelling() << A->getValue();
}
bool arm::useAAPCSForMachO(const llvm::Triple &T) {
@@ -879,7 +879,7 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
continue;
}
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Scope;
+ << A->getSpelling() << Scope;
break;
}
}
diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.cpp b/clang/lib/Driver/ToolChains/Arch/Mips.cpp
index c374d745da38..088eecf79adb 100644
--- a/clang/lib/Driver/ToolChains/Arch/Mips.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/Mips.cpp
@@ -306,7 +306,7 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple,
}
} else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
}
if (Arg *A = Args.getLastArg(options::OPT_mabs_EQ)) {
@@ -327,7 +327,7 @@ void mips::getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple,
}
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
}
}
diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index 081e8ff4a168..90a2c3ab09da 100644
--- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -73,7 +73,7 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
CPU = llvm::sys::getHostCPUName();
if (!getRISCFeaturesFromMcpu(Triple, CPU, Features))
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << CPU;
+ << A->getSpelling() << CPU;
}
// Handle features corresponding to "-ffixed-X" options
diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index d847db701825..3c8adf3cbc40 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -255,7 +255,7 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
Features.push_back("+harden-sls-ijmp");
} else if (Scope != "none") {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Scope;
+ << A->getSpelling() << Scope;
}
}
}
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4e404c579a57..8edef656be09 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -958,7 +958,7 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
CmdArgs.push_back("-fprofile-update=atomic");
else if (Val != "single")
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
} else if (SanArgs.needsTsanRt()) {
CmdArgs.push_back("-fprofile-update=atomic");
}
@@ -1141,7 +1141,7 @@ static void RenderDebugInfoCompressionArgs(const ArgList &Args,
}
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
}
}
@@ -1673,7 +1673,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
Scope = A->getValue();
if (Scope != "none" && Scope != "non-leaf" && Scope != "all")
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Scope;
+ << A->getSpelling() << Scope;
Key = "a_key";
IndirectBranches = false;
} else {
@@ -1681,7 +1681,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
llvm::ARM::ParsedBranchProtection PBP;
if (!llvm::ARM::parseBranchProtection(A->getValue(), PBP, DiagMsg))
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << DiagMsg;
+ << A->getSpelling() << DiagMsg;
if (!isAArch64 && PBP.Key == "b_key")
D.Diag(diag::warn_unsupported_branch_protection)
<< "b-key" << A->getAsString(Args);
@@ -1902,7 +1902,7 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
} else if (!Val.equals("scalable"))
// Handle the unsupported values passed to msve-vector-bits.
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
}
AddAAPCSVolatileBitfieldArgs(Args, CmdArgs);
@@ -2059,7 +2059,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val));
} else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
} else
D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName;
}
@@ -2294,7 +2294,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
CmdArgs.push_back(Args.MakeArgString("-inline-asm=" + Value));
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
} else if (D.IsCLMode()) {
CmdArgs.push_back("-mllvm");
@@ -2377,7 +2377,7 @@ void Clang::AddLanaiTargetArgs(const ArgList &Args,
if (Mregparm != 4) {
getToolChain().getDriver().Diag(
diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
}
}
@@ -2558,7 +2558,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
ImplicitIt = A->getValue();
if (!CheckARMImplicitITArg(ImplicitIt))
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << ImplicitIt;
+ << A->getSpelling() << ImplicitIt;
continue;
default:
break;
@@ -2721,7 +2721,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
D.PrintVersion(C, llvm::outs());
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
}
}
@@ -2855,7 +2855,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
TrappingMath = true;
} else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
break;
}
}
@@ -2942,7 +2942,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
LastSeenFfpContractOption = Val;
} else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
break;
}
@@ -2970,7 +2970,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
TrappingMath = TrappingMathPresent = true;
} else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
break;
}
@@ -2982,7 +2982,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
FPEvalMethod = Val;
else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
break;
}
@@ -3436,7 +3436,7 @@ static void RenderTrivialAutoVarInitOptions(const Driver &D,
TrivialAutoVarInit = Val;
else
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
break;
}
}
@@ -4094,7 +4094,7 @@ DwarfFissionKind tools::getDebugFissionKind(const Driver &D,
return DwarfFissionKind::Single;
D.Diag(diag::err_drv_unsupported_option_argument)
- << Arg->getOption().getName() << Arg->getValue();
+ << Arg->getSpelling() << Arg->getValue();
return DwarfFissionKind::None;
}
@@ -7879,7 +7879,7 @@ void ClangAs::AddX86TargetArgs(const ArgList &Args,
CmdArgs.push_back(Args.MakeArgString("-x86-asm-syntax=" + Value));
} else {
getToolChain().getDriver().Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
}
}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 6c397c697739..30fca3a4c059 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -296,7 +296,7 @@ void tools::addLinkerCompressDebugSectionsOption(
CmdArgs.push_back(Args.MakeArgString("--compress-debug-sections=" + V));
else
TC.getDriver().Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << V;
+ << A->getSpelling() << V;
}
}
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 43f6a82c33c4..c9016238ee65 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -104,7 +104,7 @@ static void addFloatingPointOptions(const Driver &D, const ArgList &Args,
// Clang's "fast-honor-pragmas" option is not supported because it is
// non-standard
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
}
for (const Arg *A : Args) {
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index a33e684fedcb..8236451b96c8 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -729,7 +729,7 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
Args.MakeArgString("--compress-debug-sections=" + Twine(Value)));
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Value;
+ << A->getSpelling() << Value;
}
}
}
diff --git a/clang/lib/Driver/ToolChains/Hexagon.cpp b/clang/lib/Driver/ToolChains/Hexagon.cpp
index 93b987c07f29..703a470b3dbf 100644
--- a/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -40,7 +40,7 @@ static void handleHVXWarnings(const Driver &D, const ArgList &Args) {
StringRef Val = A->getValue();
if (!Val.equals_insensitive("64b") && !Val.equals_insensitive("128b"))
D.Diag(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << Val;
+ << A->getSpelling() << Val;
}
}
diff --git a/clang/lib/Driver/ToolChains/MSP430.cpp b/clang/lib/Driver/ToolChains/MSP430.cpp
index bc789853049a..4edc1d2f0a1f 100644
--- a/clang/lib/Driver/ToolChains/MSP430.cpp
+++ b/clang/lib/Driver/ToolChains/MSP430.cpp
@@ -101,7 +101,7 @@ void msp430::getMSP430TargetFeatures(const Driver &D, const ArgList &Args,
Features.push_back("+hwmultf5");
} else {
D.Diag(clang::diag::err_drv_unsupported_option_argument)
- << HWMultArg->getOption().getName() << HWMult;
+ << HWMultArg->getSpelling() << HWMult;
}
}
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b004c6c21be4..088e83b148ac 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1711,7 +1711,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
StringRef Value = A->getValue();
if (Value != "simple" && Value != "mangled")
Diags.Report(diag::err_drv_unsupported_option_argument)
- << A->getOption().getName() << A->getValue();
+ << A->getSpelling() << A->getValue();
Opts.setDebugSimpleTemplateNames(
StringRef(A->getValue()) == "simple"
? codegenoptions::DebugTemplateNamesKind::Simple
diff --git a/clang/test/Driver/mingw-cfguard.c b/clang/test/Driver/mingw-cfguard.c
index d9297042b10e..f69b9c0e507b 100644
--- a/clang/test/Driver/mingw-cfguard.c
+++ b/clang/test/Driver/mingw-cfguard.c
@@ -25,4 +25,4 @@
// GUARD_NOCHECKS-NOT: "--no-guard-cf"
// RUN: %clang --target=x86_64-w64-windows-gnu -### %s -mguard=xxx 2>&1 | FileCheck -check-prefix=GUARD_UNKNOWN %s
-// GUARD_UNKNOWN: error: unsupported argument 'xxx' to option '--mguard='
+// GUARD_UNKNOWN: error: unsupported argument 'xxx' to option '-mguard='
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index f2180145af71..043c35296bf3 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -688,7 +688,7 @@ static bool parseFloatingPointArgs(CompilerInvocation &invoc,
fpContractMode = LangOptions::FPM_Fast;
else {
diags.Report(clang::diag::err_drv_unsupported_option_argument)
- << a->getOption().getName() << val;
+ << a->getSpelling() << val;
return false;
}
More information about the cfe-commits
mailing list