[Serialization] Use the new logic for transitive dependencies in the scanner

This commit is contained in:
Alexis Laferrière
2023-03-20 13:53:54 -07:00
parent 61c0827427
commit c2181b136d

View File

@@ -420,14 +420,18 @@ llvm::ErrorOr<ModuleDependencyInfo> SerializedModuleLoaderBase::scanModuleFile(
if (dependency.isHeader())
continue;
// Transitive @_implementationOnly dependencies of
// binary modules are not required to be imported during normal builds
// TODO: This is worth revisiting for debugger purposes
if (dependency.isImplementationOnly())
continue;
if (dependency.isPackageOnly() &&
Ctx.LangOpts.PackageName != loadedModuleFile->getModulePackageName())
// Some transitive dependencies of binary modules are not required to be
// imported during normal builds.
// TODO: This is worth revisiting for debugger purposes where
// loading the module is optional, and implementation-only imports
// from modules with testing enabled where the dependency is
// optional.
ModuleLoadingBehavior transitiveBehavior =
loadedModuleFile->getTransitiveLoadingBehavior(dependency,
/*debuggerMode*/false,
/*isPartialModule*/false,
/*package*/Ctx.LangOpts.PackageName);
if (transitiveBehavior != ModuleLoadingBehavior::Required)
continue;
// Find the top-level module name.