mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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
This commit is contained in:
@@ -1456,7 +1456,7 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
|
||||
|
||||
// A scanning task to query a Swift module by-name. If the module already
|
||||
// exists in the cache, do nothing and return.
|
||||
auto scanForSwiftDependency = [this, &cache, &lookupResultLock,
|
||||
auto scanForSwiftDependency = [this, &moduleID, &cache, &lookupResultLock,
|
||||
&swiftOverlayLookupResult](
|
||||
Identifier moduleIdentifier) {
|
||||
auto moduleName = moduleIdentifier.str();
|
||||
@@ -1467,6 +1467,13 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
|
||||
return;
|
||||
}
|
||||
|
||||
// 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.
|
||||
if (moduleName == moduleID.ModuleName)
|
||||
return;
|
||||
|
||||
auto moduleDependencies = withDependencyScanningWorker(
|
||||
[moduleIdentifier](ModuleDependencyScanningWorker *ScanningWorker) {
|
||||
return ScanningWorker->scanFilesystemForSwiftModuleDependency(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// REQUIRES: swift_feature_Embedded
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t
|
||||
|
||||
|
||||
Reference in New Issue
Block a user