|
26 | 26 | #include "swift/Basic/Defer.h" |
27 | 27 | #include "swift/Basic/FileTypes.h" |
28 | 28 | #include "swift/Basic/PrettyStackTrace.h" |
| 29 | +#include "swift/Basic/Statistic.h" |
29 | 30 | #include "swift/ClangImporter/ClangImporter.h" |
30 | 31 | #include "swift/Frontend/CompileJobCacheKey.h" |
31 | 32 | #include "swift/Frontend/ModuleInterfaceLoader.h" |
@@ -1347,6 +1348,13 @@ void ModuleDependencyScanner::resolveSwiftImportsForModule( |
1347 | 1348 | // Avoid querying the underlying Clang module here |
1348 | 1349 | if (moduleID.ModuleName == dependsOn.importIdentifier) |
1349 | 1350 | continue; |
| 1351 | + // Avoid querying Swift module dependencies previously discovered |
| 1352 | + if (DependencyCache.hasSwiftDependency(dependsOn.importIdentifier)) |
| 1353 | + continue; |
| 1354 | + // Avoid querying Swift module dependencies which have already produced |
| 1355 | + // in a negative (not found) result |
| 1356 | + if (DependencyCache.hasNegativeSwiftDependency(dependsOn.importIdentifier)) |
| 1357 | + continue; |
1350 | 1358 | ScanningThreadPool.async( |
1351 | 1359 | scanForSwiftModuleDependency, |
1352 | 1360 | getModuleImportIdentifier(dependsOn.importIdentifier), |
@@ -1386,10 +1394,13 @@ void ModuleDependencyScanner::resolveSwiftImportsForModule( |
1386 | 1394 | moduleImport.importIdentifier)) |
1387 | 1395 | importedSwiftDependencies.insert( |
1388 | 1396 | {moduleImport.importIdentifier, cachedInfo.value()->getKind()}); |
1389 | | - else |
| 1397 | + else { |
1390 | 1398 | ScanDiagnosticReporter.diagnoseFailureOnOnlyIncompatibleCandidates( |
1391 | 1399 | moduleImport, lookupResult.incompatibleCandidates, |
1392 | 1400 | DependencyCache, std::nullopt); |
| 1401 | + DependencyCache |
| 1402 | + .recordFailedSwiftDependencyLookup(moduleImport.importIdentifier); |
| 1403 | + } |
1393 | 1404 | }; |
1394 | 1405 |
|
1395 | 1406 | for (const auto &importInfo : moduleDependencyInfo.getModuleImports()) |
@@ -1533,10 +1544,9 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule( |
1533 | 1544 | auto moduleName = moduleIdentifier.str(); |
1534 | 1545 | { |
1535 | 1546 | std::lock_guard<std::mutex> guard(lookupResultLock); |
1536 | | - if (DependencyCache.hasDependency(moduleName, |
1537 | | - ModuleDependencyKind::SwiftInterface) || |
1538 | | - DependencyCache.hasDependency(moduleName, |
1539 | | - ModuleDependencyKind::SwiftBinary)) |
| 1547 | + if (DependencyCache.hasDependency(moduleName, ModuleDependencyKind::SwiftInterface) || |
| 1548 | + DependencyCache.hasDependency(moduleName, ModuleDependencyKind::SwiftBinary) || |
| 1549 | + DependencyCache.hasNegativeSwiftDependency(moduleName)) |
1540 | 1550 | return; |
1541 | 1551 | } |
1542 | 1552 |
|
|
0 commit comments