Skip to content

Commit e9a7519

Browse files
committed
[Dependency Scanning] Avoid querying Swift Overlay for underlying module
Avoid Swift Overlay lookup for the underlying clang module of a known Swift module. i.e. When computing set of Swift Overlay dependencies for module 'A', which depends on a Clang module 'A', ensure we don't lookup Swift module 'A' itself here - this can lead to bizarre interactions where the source module under scan is queried as a dependency of itself. Resolves rdar://159706486
1 parent 7803fe2 commit e9a7519

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/DependencyScan/ModuleDependencyScanner.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
14561456

14571457
// A scanning task to query a Swift module by-name. If the module already
14581458
// exists in the cache, do nothing and return.
1459-
auto scanForSwiftDependency = [this, &cache, &lookupResultLock,
1459+
auto scanForSwiftDependency = [this, &moduleID, &cache, &lookupResultLock,
14601460
&swiftOverlayLookupResult](
14611461
Identifier moduleIdentifier) {
14621462
auto moduleName = moduleIdentifier.str();
@@ -1467,6 +1467,13 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
14671467
return;
14681468
}
14691469

1470+
// Avoid Swift overlay lookup for the underlying clang module of a known
1471+
// Swift module. i.e. When computing set of Swift Overlay dependencies
1472+
// for module 'A', which depends on a Clang module 'A', ensure we don't
1473+
// lookup Swift module 'A' itself here.
1474+
if (moduleName == moduleID.ModuleName)
1475+
return;
1476+
14701477
auto moduleDependencies = withDependencyScanningWorker(
14711478
[moduleIdentifier](ModuleDependencyScanningWorker *ScanningWorker) {
14721479
return ScanningWorker->scanFilesystemForSwiftModuleDependency(

test/ScanDependencies/embedded_no_textual.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: swift_feature_Embedded
12
// RUN: %empty-directory(%t)
23
// RUN: split-file %s %t
34

0 commit comments

Comments
 (0)