aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorUsman Nadeem <mnadeem@quicinc.com>2021-09-08 15:52:19 -0700
committerUsman Nadeem <mnadeem@quicinc.com>2021-09-08 15:53:49 -0700
commit0a9d740c232e1e4b71fcbbaf844211d70b06d873 (patch)
tree9518f82a3a6df4be8836e6716723809aba249737 /clang/lib/Frontend/CompilerInvocation.cpp
parent78f7ad5a83c3b7f37b5331486c289eba1040d56a (diff)
downloadllvm-0a9d740c232e1e4b71fcbbaf844211d70b06d873.zip
llvm-0a9d740c232e1e4b71fcbbaf844211d70b06d873.tar.gz
llvm-0a9d740c232e1e4b71fcbbaf844211d70b06d873.tar.bz2
[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is honored
- Make flto an alias of flto=full. - Make foffload-lto an alias of foffload-lto=full. - Make flto_EQ_jobserver, flto_EQ_auto aliases of flto=full, since they are being treated as full lto right now. - Clean up the code for parseLTOMode and setLTOMode. - Replace uses of OPT_flto with OPT_flto_EQ since they alias now. Differential Revision: https://reviews.llvm.org/D108881 Change-Id: I5d867db83a680434fba5c8d85c9a83135d3b81ee
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 014595c..c23740fd 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1419,7 +1419,7 @@ void CompilerInvocation::GenerateCodeGenArgs(
}
if (Opts.PrepareForLTO && !Opts.PrepareForThinLTO)
- GenerateArg(Args, OPT_flto, SA);
+ GenerateArg(Args, OPT_flto_EQ, "full", SA);
if (Opts.PrepareForThinLTO)
GenerateArg(Args, OPT_flto_EQ, "thin", SA);
@@ -1706,9 +1706,10 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
}
}
- Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
+ Opts.PrepareForLTO = false;
Opts.PrepareForThinLTO = false;
if (Arg *A = Args.getLastArg(OPT_flto_EQ)) {
+ Opts.PrepareForLTO = true;
StringRef S = A->getValue();
if (S == "thin")
Opts.PrepareForThinLTO = true;