Skip to content

Commit 7e9f45e

Browse files
committed
[Explicit Module Build] Do not serialize binary .swiftmodule dependencies when building explicit interface dependencies
The build-system (swift-driver) is then responsible for validating all inputs to each module and re-scheduling affected modules.
1 parent ca1e4b1 commit 7e9f45e

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 building explicit module dependencies, they 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 because the build system (swift-driver) is then
417+
// responsible for checking whether inputs are up-to-date.
418+
bool ShouldSerializeDeps = !FEOpts.ExplicitInterfaceBuild;
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)