ClangImporter: Update Swift for changes in clang (PCH + Modules issues)
This sets the NeededByPCHOrCompilationUsesPCH language option when
emitting a brigding PCH.
rdar://problem/35056912
rdar://problem/30384801
Initial patch by Adrian Prantl
(cherry picked from commit 5d5f542fe47668f80a4661ccccdb0048c9629a39)
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());