Skip to content

Revert "[6.0🍒][Dependency Scanning] Use a standalone DependencyScanningFilesystem on the scanner, sharing a common status cache from Clang's dependency service cache" #73233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions include/swift/AST/ModuleDependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,11 @@ class SwiftDependencyScanningService {
/// File prefix mapper.
std::unique_ptr<llvm::TreePathPrefixMapper> Mapper;

/// The global file system cache.
std::optional<
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache>
SharedFilesystemCache;

/// A map from a String representing the target triple of a scanner invocation
/// to the corresponding cached dependencies discovered so far when using this
/// triple.
Expand Down Expand Up @@ -914,6 +919,19 @@ class SwiftDependencyScanningService {
operator=(const SwiftDependencyScanningService &) = delete;
virtual ~SwiftDependencyScanningService() {}

/// Query the service's filesystem cache
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &getSharedCache() {
assert(SharedFilesystemCache && "Expected a shared cache");
return *SharedFilesystemCache;
}

/// Query the service's filesystem cache
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &
getSharedFilesystemCache() {
assert(SharedFilesystemCache && "Expected a shared cache");
return *SharedFilesystemCache;
}

bool usingCachingFS() const { return !UseClangIncludeTree && (bool)CacheFS; }
llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem> getCachingFS() const { return CacheFS; }

Expand Down
1 change: 1 addition & 0 deletions lib/AST/ModuleDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
/* CAS (llvm::cas::ObjectStore) */ nullptr,
/* Cache (llvm::cas::ActionCache) */ nullptr,
/* SharedFS */ nullptr);
SharedFilesystemCache.emplace();
}

bool
Expand Down
11 changes: 0 additions & 11 deletions lib/DependencyScan/ModuleDependencyScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,6 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
auto ClangModuleCachePath = getModuleCachePathFromClang(
ScanASTContext.getClangModuleLoader()->getClangInstance());
auto &FEOpts = ScanCompilerInvocation.getFrontendOptions();

// Configure the filesystem to use the same shared `stat` cache as the Clang
// worker uses.
if (!globalScanningService.CacheFS) {
auto DepFS = llvm::makeIntrusiveRefCnt<
clang::tooling::dependencies::DependencyScanningWorkerFilesystem>(
globalScanningService.ClangScanningService->getSharedCache(),
ScanASTContext.SourceMgr.getFileSystem());
ScanASTContext.SourceMgr.setFileSystem(std::move(DepFS));
}

ModuleInterfaceLoaderOptions LoaderOpts(FEOpts);
ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
ScanASTContext.SourceMgr, &ScanASTContext.Diags,
Expand Down