mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Driver/ClangImporter] Changes for the driver to recognize -pch-output-dir and propagate to the frontend invocations
For the multiple-files mode -emit-pch is still invoked in separate frontend invocation but with using a persistent PCH. Subsequent frontend invocations use the persistent PCH but they don't need to validate it. For all-files mode (e.g. WMO) the frontend invocation uses a persistent PCH that it also validates.
This commit is contained in:
@@ -459,6 +459,15 @@ static bool performCompile(CompilerInstance &Instance,
|
||||
if (Action == FrontendOptions::EmitPCH) {
|
||||
auto clangImporter = static_cast<ClangImporter *>(
|
||||
Instance.getASTContext().getClangModuleLoader());
|
||||
auto &ImporterOpts = Invocation.getClangImporterOptions();
|
||||
auto &PCHOutDir = ImporterOpts.PrecompiledHeaderOutputDir;
|
||||
if (!PCHOutDir.empty()) {
|
||||
ImporterOpts.BridgingHeader = Invocation.getInputFilenames()[0];
|
||||
// Create or validate a persistent PCH.
|
||||
auto SwiftPCHHash = Invocation.getPCHHash();
|
||||
auto PCH = clangImporter->getOrCreatePCH(ImporterOpts, SwiftPCHHash);
|
||||
return !PCH.hasValue();
|
||||
}
|
||||
return clangImporter->emitBridgingPCH(
|
||||
Invocation.getInputFilenames()[0],
|
||||
opts.getSingleOutputFilename());
|
||||
|
||||
Reference in New Issue
Block a user