@@ -1529,17 +1529,12 @@ swift::dependencies::performModuleScan(
15291529
15301530 // Identify imports of the main module and add an entry for it
15311531 // to the dependency graph.
1532- auto mainModuleDepInfo =
1533- scanner.getMainModuleDependencyInfo (instance.getMainModule ());
15341532 auto mainModuleName = instance.getMainModule ()->getNameStr ();
15351533 auto mainModuleID = ModuleDependencyID{mainModuleName.str (),
15361534 ModuleDependencyKind::SwiftSource};
1537- // We may be re-using an instance of the cache which already contains
1538- // an entry for this module.
1539- if (cache.findDependency (mainModuleID))
1540- cache.updateDependency (mainModuleID, std::move (*mainModuleDepInfo));
1541- else
1542- cache.recordDependency (mainModuleName, std::move (*mainModuleDepInfo));
1535+ if (!cache.hasDependency (mainModuleID))
1536+ cache.recordDependency (mainModuleName,
1537+ *scanner.getMainModuleDependencyInfo (instance.getMainModule ()));
15431538
15441539 // Perform the full module scan starting at the main module.
15451540 auto allModules = scanner.performDependencyScan (mainModuleID, cache);
@@ -1552,6 +1547,10 @@ swift::dependencies::performModuleScan(
15521547 topologicallySortedModuleList);
15531548 resolveImplicitLinkLibraries (instance, cache);
15541549 updateDependencyTracker (instance, cache, allModules);
1550+
1551+ if (instance.getInvocation ().getFrontendOptions ().EmitDependencyScannerCacheRemarks )
1552+ instance.getASTContext ().Diags .diagnose (SourceLoc (), diag::remark_scanner_uncached_lookups, scanner.getNumLookups ());
1553+
15551554 return generateFullDependencyGraph (instance, diagnosticCollector, cache,
15561555 topologicallySortedModuleList);
15571556}
0 commit comments