Merge pull request #14786 from jrose-apple/pch-woes
diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp
index 666fab4..b2d18ca 100644
--- a/lib/ClangImporter/ClangImporter.cpp
+++ b/lib/ClangImporter/ClangImporter.cpp
@@ -995,6 +995,7 @@
if (importerOpts.Mode == ClangImporterOptions::Modes::EmbedBitcode)
return importer;
+ instance.getLangOpts().NeededByPCHOrCompilationUsesPCH = true;
bool canBegin = action->BeginSourceFile(instance,
instance.getFrontendOpts().Inputs[0]);
if (!canBegin)
@@ -1373,6 +1374,7 @@
invocation->getFrontendOpts().OutputFile = outputPCHPath;
invocation->getFrontendOpts().ProgramAction = clang::frontend::GeneratePCH;
invocation->getPreprocessorOpts().resetNonModularOptions();
+ invocation->getLangOpts()->NeededByPCHOrCompilationUsesPCH = true;
clang::CompilerInstance emitInstance(
Impl.Instance->getPCHContainerOperations());