[Dependency Scanner] Rename 'GlobalModuleDependenciesCache' -> 'SwiftDependencyScanningService'

This commit is contained in:
Artem Chikin
2022-12-15 14:33:45 -08:00
parent 1230966e80
commit a59db26a55
12 changed files with 100 additions and 93 deletions

View File

@@ -103,7 +103,7 @@ void DependencyScannerDiagnosticCollectingConsumer::addDiagnostic(SourceManager
}
DependencyScanningTool::DependencyScanningTool()
: SharedCache(std::make_unique<GlobalModuleDependenciesCache>()),
: ScanningService(std::make_unique<SwiftDependencyScanningService>()),
VersionedPCMInstanceCacheCache(
std::make_unique<CompilerArgInstanceCacheMap>()),
CDC(), Alloc(), Saver(Alloc) {}
@@ -119,7 +119,7 @@ DependencyScanningTool::getDependencies(
auto Instance = std::move(*InstanceOrErr);
// Local scan cache instance, wrapping the shared global cache.
ModuleDependenciesCache cache(*SharedCache,
ModuleDependenciesCache cache(*ScanningService,
Instance->getMainModule()->getNameStr().str(),
Instance->getInvocation().getModuleScanningHash());
// Execute the scanning action, retrieving the in-memory result
@@ -161,7 +161,7 @@ DependencyScanningTool::getDependencies(
auto Instance = std::move(*InstanceOrErr);
// Local scan cache instance, wrapping the shared global cache.
ModuleDependenciesCache cache(*SharedCache,
ModuleDependenciesCache cache(*ScanningService,
Instance->getMainModule()->getNameStr().str(),
Instance->getInvocation().getModuleScanningHash());
auto BatchScanResults = performBatchModuleScan(
@@ -176,17 +176,17 @@ void DependencyScanningTool::serializeCache(llvm::StringRef path) {
DiagnosticEngine Diags(SM);
Diags.addConsumer(CDC);
module_dependency_cache_serialization::writeInterModuleDependenciesCache(
Diags, path, *SharedCache);
Diags, path, *ScanningService);
}
bool DependencyScanningTool::loadCache(llvm::StringRef path) {
SourceManager SM;
DiagnosticEngine Diags(SM);
Diags.addConsumer(CDC);
SharedCache = std::make_unique<GlobalModuleDependenciesCache>();
ScanningService = std::make_unique<SwiftDependencyScanningService>();
bool readFailed =
module_dependency_cache_serialization::readInterModuleDependenciesCache(
path, *SharedCache);
path, *ScanningService);
if (readFailed) {
Diags.diagnose(SourceLoc(), diag::warn_scanner_deserialize_failed, path);
}
@@ -194,7 +194,7 @@ bool DependencyScanningTool::loadCache(llvm::StringRef path) {
}
void DependencyScanningTool::resetCache() {
SharedCache.reset(new GlobalModuleDependenciesCache());
ScanningService.reset(new SwiftDependencyScanningService());
}
void DependencyScanningTool::resetDiagnostics() {
@@ -218,7 +218,7 @@ DependencyScanningTool::initCompilerInstanceForScan(
Instance->addDiagnosticConsumer(&CDC);
// Wrap the filesystem with a caching `DependencyScanningWorkerFilesystem`
SharedCache->overlaySharedFilesystemCacheForCompilation(*Instance);
ScanningService->overlaySharedFilesystemCacheForCompilation(*Instance);
// Basic error checking on the arguments
if (CommandArgs.empty()) {