Skip to content

Commit f1dfdf6

Browse files
bcardosolopesjrose-apple
authored andcommitted
ClangImporter: Update Swift for changes in clang (PCH + Modules issues) (#20240)
This sets the NeededByPCHOrCompilationUsesPCH language option when emitting a brigding PCH. rdar://problem/35056912 rdar://problem/30384801 rdar://problem/45714111 Initial patch by Adrian Prantl (cherry picked from commit 5d5f542) (cherry picked from commit fa2a577)
1 parent d8e4a8f commit f1dfdf6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ ClangImporter::create(ASTContext &ctx,
10231023
if (importerOpts.Mode == ClangImporterOptions::Modes::EmbedBitcode)
10241024
return importer;
10251025

1026+
instance.getLangOpts().NeededByPCHOrCompilationUsesPCH = true;
10261027
bool canBegin = action->BeginSourceFile(instance,
10271028
instance.getFrontendOpts().Inputs[0]);
10281029
if (!canBegin)
@@ -1403,6 +1404,7 @@ ClangImporter::emitBridgingPCH(StringRef headerPath,
14031404
invocation->getFrontendOpts().OutputFile = outputPCHPath;
14041405
invocation->getFrontendOpts().ProgramAction = clang::frontend::GeneratePCH;
14051406
invocation->getPreprocessorOpts().resetNonModularOptions();
1407+
invocation->getLangOpts()->NeededByPCHOrCompilationUsesPCH = true;
14061408

14071409
clang::CompilerInstance emitInstance(
14081410
Impl.Instance->getPCHContainerOperations());

0 commit comments

Comments
 (0)