Really don't warn about -flto/fno-lto :-(
This should fix the last bots.
llvm-svn: 225100
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index de2afd5..e81e936 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -2440,6 +2440,19 @@
llvm::utostr_32(Build);
}
+// Claim options we don't want to warn if they are unused. We do this for
+// options that
+// build systems might add but are unused when assembling or only running the
+// preprocessor
+// for example.
+static void claimNoWarnArgs(const ArgList &Args) {
+ // Don't warn about unused -f(no-)?lto. This can happen when we're
+ // preprocessing,
+ // precompiling or assembling.
+ Args.ClaimAllArgs(options::OPT_flto);
+ Args.ClaimAllArgs(options::OPT_fno_lto);
+}
+
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
@@ -3379,10 +3392,7 @@
D.Diag(diag::warn_ignored_gcc_optimization) << (*it)->getAsString(Args);
}
- // Don't warn about unused -f(no-)?lto. This can happen when we're preprocessing or
- // precompiling.
- Args.ClaimAllArgs(options::OPT_flto);
- Args.ClaimAllArgs(options::OPT_fno_lto);
+ claimNoWarnArgs(Args);
Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
@@ -4810,10 +4820,7 @@
// and "clang -emit-llvm -c foo.s"
Args.ClaimAllArgs(options::OPT_emit_llvm);
- // Don't warn on -flto/-fno-lto
- // FIXME: Code duplicated with Clang::ConstructJob.
- Args.ClaimAllArgs(options::OPT_flto);
- Args.ClaimAllArgs(options::OPT_fno_lto);
+ claimNoWarnArgs(Args);
// Invoke ourselves in -cc1as mode.
//
@@ -5095,6 +5102,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
@@ -6004,6 +6012,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
@@ -6129,6 +6138,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
bool NeedsKPIC = false;
@@ -6331,6 +6341,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
@@ -6467,6 +6478,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
// When building 32-bit code on FreeBSD/amd64, we have to explicitly
@@ -6732,6 +6744,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
// GNU as needs different flags for creating the correct output format
@@ -7014,6 +7027,8 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
+
ArgStringList CmdArgs;
bool NeedsKPIC = false;
@@ -7574,6 +7589,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
@@ -7651,6 +7667,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
// When building 32-bit code on DragonFly/pc64, we have to explicitly
@@ -8083,6 +8100,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
ArgStringList CmdArgs;
CmdArgs.push_back("-o");
@@ -8142,6 +8160,7 @@
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ claimNoWarnArgs(Args);
const auto &TC =
static_cast<const toolchains::CrossWindowsToolChain &>(getToolChain());
ArgStringList CmdArgs;