Skip to content

Commit b1707ef

Browse files
authored
Merge pull request #63201 from artemcm/ScannerNoPriorSourceDeps
[Dependency Scanner] Do not re-use prior source dependencies in successive scans
2 parents af7cf15 + e2eb8c8 commit b1707ef

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/AST/ModuleDependencies.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,19 @@ ModuleDependenciesCache::ModuleDependenciesCache(
422422
Optional<const ModuleDependencyInfo*>
423423
ModuleDependenciesCache::findDependency(
424424
StringRef moduleName, Optional<ModuleDependencyKind> kind) const {
425-
return globalScanningService.findDependency(moduleName, kind);
425+
auto optionalDep = globalScanningService.findDependency(moduleName, kind);
426+
// During a scan, only produce the cached source module info for the current module
427+
// under scan.
428+
if (optionalDep.hasValue()) {
429+
auto dep = optionalDep.getValue();
430+
if (dep->getAsSwiftSourceModule() &&
431+
moduleName != mainScanModuleName &&
432+
moduleName != "DummyMainModuleForResolvingCrossImportOverlays") {
433+
return None;
434+
}
435+
}
436+
437+
return optionalDep;
426438
}
427439

428440
bool ModuleDependenciesCache::hasDependency(

0 commit comments

Comments
 (0)