ClangImporter: Use the new CacheGeneratedPCH in Clang

This flag causes the generated PCH to be written into the in-memory
module cache.  Every CompilerInstance that tries to read the PCH will
use it rather than reading a potentially-since-overwritten version from
the filesystem.

rdar://problem/48740787
(cherry picked from commit 236fc19121)
This commit is contained in:
Duncan P. N. Exon Smith
2019-03-12 11:38:42 -07:00
parent a42bc62397
commit da8a1c57e8

View File

@@ -1440,6 +1440,7 @@ ClangImporter::emitBridgingPCH(StringRef headerPath,
invocation->getFrontendOpts().ProgramAction = clang::frontend::GeneratePCH; invocation->getFrontendOpts().ProgramAction = clang::frontend::GeneratePCH;
invocation->getPreprocessorOpts().resetNonModularOptions(); invocation->getPreprocessorOpts().resetNonModularOptions();
invocation->getLangOpts()->NeededByPCHOrCompilationUsesPCH = true; invocation->getLangOpts()->NeededByPCHOrCompilationUsesPCH = true;
invocation->getLangOpts()->CacheGeneratedPCH = true;
clang::CompilerInstance emitInstance( clang::CompilerInstance emitInstance(
Impl.Instance->getPCHContainerOperations(), Impl.Instance->getPCHContainerOperations(),