[clang] [Clang][Driver][LTO] Fix empty stats filename when in LTO mode (PR #71197)
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 4 16:17:40 PDT 2023
================
@@ -535,7 +535,15 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (D.isUsingLTO()) {
assert(!Inputs.empty() && "Must have at least one input.");
- addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
+ // Find the first filename InputInfo object.
+ auto Input = llvm::find_if(
+ Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); });
+ if (Input == Inputs.end())
+ // For a very rare case, all of the inputs to the linker are
+ // flags. If that happens, just use the first InputInfo.
----------------
MaskRay wrote:
In Clang, flags only refer to boolean options (i.e. not `-fxxx=yy`). It seems that the canonical term here is `InputArg`.
https://github.com/llvm/llvm-project/pull/71197
More information about the cfe-commits
mailing list