mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Make JSON fix-it outputs be per-primary in batch mode. (#14995)
This means moving the output path into SupplementaryOutputPaths, and using the same sort of diagnostic dispatching that serialized diagnostics use. This is part of what's needed to run the migrator in batch mode.
This commit is contained in:
@@ -908,8 +908,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParseMigratorArgs(MigratorOptions &Opts, llvm::Triple &Triple,
|
||||
StringRef ResourcePath, ArgList &Args,
|
||||
bool ParseMigratorArgs(MigratorOptions &Opts,
|
||||
const FrontendOptions &FrontendOpts,
|
||||
const llvm::Triple &Triple,
|
||||
StringRef ResourcePath, const ArgList &Args,
|
||||
DiagnosticEngine &Diags) {
|
||||
using namespace options;
|
||||
|
||||
@@ -958,6 +960,21 @@ bool ParseMigratorArgs(MigratorOptions &Opts, llvm::Triple &Triple,
|
||||
}
|
||||
}
|
||||
|
||||
if (Opts.shouldRunMigrator()) {
|
||||
assert(!FrontendOpts.InputsAndOutputs.isWholeModule());
|
||||
// FIXME: In order to support batch mode properly, the migrator would have
|
||||
// to support having one remap file path and one migrated file path per
|
||||
// primary input. The easiest way to do this would be to move processing of
|
||||
// these paths into FrontendOptions, like other supplementary outputs, and
|
||||
// to call migrator::updateCodeAndEmitRemapIfNeeded once for each primary
|
||||
// file.
|
||||
//
|
||||
// Supporting WMO would be similar, but WMO is set up to only produce one
|
||||
// supplementary output for the whole compilation instead of one per input,
|
||||
// so it's probably not worth it.
|
||||
FrontendOpts.InputsAndOutputs.assertMustNotBeMoreThanOnePrimaryInput();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1022,7 +1039,7 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ParseMigratorArgs(MigratorOpts, LangOpts.Target,
|
||||
if (ParseMigratorArgs(MigratorOpts, FrontendOpts, LangOpts.Target,
|
||||
SearchPathOpts.RuntimeResourcePath, ParsedArgs, Diags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user