|
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" |
@@ -1389,6 +1390,13 @@ void ModuleDependencyScanner::resolveSwiftImportsForModule( |
1389 | 1390 | // Avoid querying the underlying Clang module here |
1390 | 1391 | if (moduleID.ModuleName == dependsOn.importIdentifier) |
1391 | 1392 | continue; |
| 1393 | + // Avoid querying Swift module dependencies previously discovered |
| 1394 | + if (DependencyCache.hasSwiftDependency(dependsOn.importIdentifier)) |
| 1395 | + continue; |
| 1396 | + // Avoid querying Swift module dependencies which have already produced |
| 1397 | + // in a negative (not found) result |
| 1398 | + if (DependencyCache.hasNegativeSwiftDependency(dependsOn.importIdentifier)) |
| 1399 | + continue; |
1392 | 1400 | ScanningThreadPool.async( |
1393 | 1401 | scanForSwiftModuleDependency, |
1394 | 1402 | getModuleImportIdentifier(dependsOn.importIdentifier), |
@@ -1428,10 +1436,13 @@ void ModuleDependencyScanner::resolveSwiftImportsForModule( |
1428 | 1436 | moduleImport.importIdentifier)) |
1429 | 1437 | importedSwiftDependencies.insert( |
1430 | 1438 | {moduleImport.importIdentifier, cachedInfo.value()->getKind()}); |
1431 | | - else |
| 1439 | + else { |
1432 | 1440 | ScanDiagnosticReporter.diagnoseFailureOnOnlyIncompatibleCandidates( |
1433 | 1441 | moduleImport, lookupResult.incompatibleCandidates, |
1434 | 1442 | DependencyCache, std::nullopt); |
| 1443 | + DependencyCache |
| 1444 | + .recordFailedSwiftDependencyLookup(moduleImport.importIdentifier); |
| 1445 | + } |
1435 | 1446 | }; |
1436 | 1447 |
|
1437 | 1448 | for (const auto &importInfo : moduleDependencyInfo.getModuleImports()) |
@@ -1575,10 +1586,9 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule( |
1575 | 1586 | auto moduleName = moduleIdentifier.str(); |
1576 | 1587 | { |
1577 | 1588 | std::lock_guard<std::mutex> guard(lookupResultLock); |
1578 | | - if (DependencyCache.hasDependency(moduleName, |
1579 | | - ModuleDependencyKind::SwiftInterface) || |
1580 | | - DependencyCache.hasDependency(moduleName, |
1581 | | - ModuleDependencyKind::SwiftBinary)) |
| 1589 | + if (DependencyCache.hasDependency(moduleName, ModuleDependencyKind::SwiftInterface) || |
| 1590 | + DependencyCache.hasDependency(moduleName, ModuleDependencyKind::SwiftBinary) || |
| 1591 | + DependencyCache.hasNegativeSwiftDependency(moduleName)) |
1582 | 1592 | return; |
1583 | 1593 | } |
1584 | 1594 |
|
|
0 commit comments