Fix per-file supplementary outputs in multi-threaded WMO mode

In multi-threaded WMO builds, the frontend didn't properly handle per-file
supplementary outputs specified via output file maps or command-line
arguments.

This enables swift-driver to use -supplementary-output-file-map for
per-file outputs in multi-threaded WMO, instead of generating multiple
individual flags that the frontend rejects.
This commit is contained in:
Ryan Mansfield
2025-11-12 11:30:53 -05:00
parent 7b5a479d57
commit 1f5fb751b5
5 changed files with 236 additions and 38 deletions

View File

@@ -3231,8 +3231,12 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
if (const Arg *A = Args.getLastArg(OPT_save_optimization_record_passes))
Opts.OptRecordPasses = A->getValue();
if (const Arg *A = Args.getLastArg(OPT_save_optimization_record_path))
Opts.OptRecordFile = A->getValue();
// Only use getLastArg for single -save-optimization-record-path.
// With multiple paths (multi-threaded WMO), FrontendTool will populate
// OptRecordFile and AuxOptRecordFiles from command-line arguments.
auto allOptRecordPaths = Args.getAllArgValues(OPT_save_optimization_record_path);
if (allOptRecordPaths.size() == 1)
Opts.OptRecordFile = allOptRecordPaths[0];
// If any of the '-g<kind>', except '-gnone', is given,
// tell the SILPrinter to print debug info as well