Skip to content

Commit d7a427a

Browse files
committed
[Frontend] Emit incr compilation info from emit-module jobs
Enable emitting the module-level incremental fine-grained compilation information from the emit-module job for incremental compilation to work with emit-module-separately.
1 parent e6826e3 commit d7a427a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,9 +1549,19 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
15491549
SerializationOptions serializationOpts =
15501550
Invocation.computeSerializationOptions(outs, Instance.getMainModule());
15511551

1552+
// Infer if this is an emit-module job part of an incremental build,
1553+
// vs a partial emit-module job (with primary files) or other kinds.
1554+
// We may want to rely on a flag instead to differentiate them.
1555+
const bool isEmitModuleSeparately =
1556+
Action == FrontendOptions::ActionType::EmitModuleOnly &&
1557+
MSF.is<ModuleDecl *>() &&
1558+
Instance.getInvocation()
1559+
.getTypeCheckerOptions()
1560+
.SkipFunctionBodies == FunctionBodySkipping::NonInlinableWithoutTypes;
15521561
const bool canEmitIncrementalInfoIntoModule =
15531562
!serializationOpts.DisableCrossModuleIncrementalInfo &&
1554-
(Action == FrontendOptions::ActionType::MergeModules);
1563+
(Action == FrontendOptions::ActionType::MergeModules ||
1564+
isEmitModuleSeparately);
15551565
if (canEmitIncrementalInfoIntoModule) {
15561566
const auto alsoEmitDotFile =
15571567
Instance.getInvocation()

0 commit comments

Comments
 (0)