Skip to content

Commit c2181b1

Browse files
committed
[Serialization] Use the new logic for transitive dependencies in the scanner
1 parent 61c0827 commit c2181b1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,18 @@ llvm::ErrorOr<ModuleDependencyInfo> SerializedModuleLoaderBase::scanModuleFile(
420420
if (dependency.isHeader())
421421
continue;
422422

423-
// Transitive @_implementationOnly dependencies of
424-
// binary modules are not required to be imported during normal builds
425-
// TODO: This is worth revisiting for debugger purposes
426-
if (dependency.isImplementationOnly())
427-
continue;
428-
429-
if (dependency.isPackageOnly() &&
430-
Ctx.LangOpts.PackageName != loadedModuleFile->getModulePackageName())
423+
// Some transitive dependencies of binary modules are not required to be
424+
// imported during normal builds.
425+
// TODO: This is worth revisiting for debugger purposes where
426+
// loading the module is optional, and implementation-only imports
427+
// from modules with testing enabled where the dependency is
428+
// optional.
429+
ModuleLoadingBehavior transitiveBehavior =
430+
loadedModuleFile->getTransitiveLoadingBehavior(dependency,
431+
/*debuggerMode*/false,
432+
/*isPartialModule*/false,
433+
/*package*/Ctx.LangOpts.PackageName);
434+
if (transitiveBehavior != ModuleLoadingBehavior::Required)
431435
continue;
432436

433437
// Find the top-level module name.

0 commit comments

Comments
 (0)