Skip to content

Commit 5dd4977

Browse files
committed
Revert "[Dependency Scanning] Use a standalone DependencyScanningFilesystem on the scanner, sharing a common status cache from Clang's dependency service cache"
This reverts commit 1804a84.
1 parent 741cd47 commit 5dd4977

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

include/swift/AST/ModuleDependencies.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,11 @@ class SwiftDependencyScanningService {
982982
/// File prefix mapper.
983983
std::unique_ptr<llvm::TreePathPrefixMapper> Mapper;
984984

985+
/// The global file system cache.
986+
std::optional<
987+
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache>
988+
SharedFilesystemCache;
989+
985990
/// A map from a String representing the target triple of a scanner invocation
986991
/// to the corresponding cached dependencies discovered so far when using this
987992
/// triple.
@@ -1011,6 +1016,19 @@ class SwiftDependencyScanningService {
10111016
operator=(const SwiftDependencyScanningService &) = delete;
10121017
virtual ~SwiftDependencyScanningService() {}
10131018

1019+
/// Query the service's filesystem cache
1020+
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &getSharedCache() {
1021+
assert(SharedFilesystemCache && "Expected a shared cache");
1022+
return *SharedFilesystemCache;
1023+
}
1024+
1025+
/// Query the service's filesystem cache
1026+
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &
1027+
getSharedFilesystemCache() {
1028+
assert(SharedFilesystemCache && "Expected a shared cache");
1029+
return *SharedFilesystemCache;
1030+
}
1031+
10141032
bool usingCachingFS() const { return !UseClangIncludeTree && (bool)CacheFS; }
10151033
llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem>
10161034
getCachingFS() const {

lib/AST/ModuleDependencies.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
507507
/* CAS (llvm::cas::ObjectStore) */ nullptr,
508508
/* Cache (llvm::cas::ActionCache) */ nullptr,
509509
/* SharedFS */ nullptr);
510+
SharedFilesystemCache.emplace();
510511
}
511512

512513
bool

lib/DependencyScan/ModuleDependencyScanner.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,6 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
173173
auto ClangModuleCachePath = getModuleCachePathFromClang(
174174
ScanASTContext.getClangModuleLoader()->getClangInstance());
175175
auto &FEOpts = ScanCompilerInvocation.getFrontendOptions();
176-
177-
// Configure the filesystem to use the same shared `stat` cache as the Clang
178-
// worker uses.
179-
if (!globalScanningService.CacheFS) {
180-
auto DepFS = llvm::makeIntrusiveRefCnt<
181-
clang::tooling::dependencies::DependencyScanningWorkerFilesystem>(
182-
globalScanningService.ClangScanningService->getSharedCache(),
183-
ScanASTContext.SourceMgr.getFileSystem());
184-
ScanASTContext.SourceMgr.setFileSystem(std::move(DepFS));
185-
}
186-
187176
ModuleInterfaceLoaderOptions LoaderOpts(FEOpts);
188177
ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
189178
ScanASTContext.SourceMgr, &ScanASTContext.Diags,

0 commit comments

Comments
 (0)