mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Frontend] Add a new -index-unit-ouput-path and filelist equivalent to the frontend
These new options mirror -o and -output-filelist and are used instead of those options to supply the output file path(s) to record in the index store. This is intended to allow sharing index data across builds in separate directories that are otherwise equivalent as far as the index data is concered (e.g. an ASAN build and a non-ASAN build) by supplying the same -index-unit-output-path for both. Resolves rdar://problem/74816412
This commit is contained in:
@@ -1665,7 +1665,10 @@ static void emitIndexDataForSourceFile(SourceFile *PrimarySourceFile,
|
||||
const PrimarySpecificPaths &PSPs =
|
||||
opts.InputsAndOutputs.getPrimarySpecificPathsForPrimary(
|
||||
PrimarySourceFile->getFilename());
|
||||
(void) index::indexAndRecord(PrimarySourceFile, PSPs.OutputFilename,
|
||||
StringRef OutputFile = PSPs.IndexUnitOutputFilename;
|
||||
if (OutputFile.empty())
|
||||
OutputFile = PSPs.OutputFilename;
|
||||
(void) index::indexAndRecord(PrimarySourceFile, OutputFile,
|
||||
opts.IndexStorePath, opts.IndexSystemModules,
|
||||
opts.IndexIgnoreStdlib, isDebugCompilation,
|
||||
Invocation.getTargetTriple(),
|
||||
@@ -1674,10 +1677,11 @@ static void emitIndexDataForSourceFile(SourceFile *PrimarySourceFile,
|
||||
std::string moduleToken =
|
||||
Invocation.getModuleOutputPathForAtMostOnePrimary();
|
||||
if (moduleToken.empty())
|
||||
moduleToken = opts.InputsAndOutputs.getSingleOutputFilename();
|
||||
moduleToken = opts.InputsAndOutputs.getSingleIndexUnitOutputFilename();
|
||||
|
||||
(void) index::indexAndRecord(Instance.getMainModule(),
|
||||
opts.InputsAndOutputs.copyOutputFilenames(),
|
||||
opts.InputsAndOutputs
|
||||
.copyIndexUnitOutputFilenames(),
|
||||
moduleToken, opts.IndexStorePath,
|
||||
opts.IndexSystemModules,
|
||||
opts.IndexIgnoreStdlib,
|
||||
|
||||
Reference in New Issue
Block a user