Skip to content

Commit 782a421

Browse files
[Caching] Do not serialize module deps when caching
There is no need to serialize module deps when caching is on because the entire build command has already capture the entire dependency tree. There is no need to encode the has for all dependencies and try to validate them. rdar://122914546
1 parent e99a93b commit 782a421

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
410410
bool IgnoreAdjacentModules = Instance.hasASTContext() &&
411411
Instance.getASTContext().IgnoreAdjacentModules;
412412

413+
// When caching is enabled, the explicit module build dependencies are
414+
// discovered by dependency scanner and the swiftmodule is already rebuilt
415+
// ignoring candidate module. There is no need to serialized dependencies for
416+
// validation purpose.
417+
bool ShouldSerializeDeps =
418+
!Instance.getInvocation().getCASOptions().EnableCaching;
419+
413420
// If an explicit interface build was requested, bypass the creation of a new
414421
// sub-instance from the interface which will build it in a separate thread,
415422
// and isntead directly use the current \c Instance for compilation.
@@ -422,8 +429,7 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
422429
return ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
423430
Instance, Invocation.getClangModuleCachePath(),
424431
FEOpts.BackupModuleInterfaceDir, PrebuiltCachePath, ABIPath, InputPath,
425-
Invocation.getOutputFilename(),
426-
/* shouldSerializeDeps */ true,
432+
Invocation.getOutputFilename(), ShouldSerializeDeps,
427433
Invocation.getSearchPathOptions().CandidateCompiledModules);
428434

429435
return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(

0 commit comments

Comments
 (0)