File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -886,6 +886,11 @@ class SwiftDependencyScanningService {
886886 // / File prefix mapper.
887887 std::unique_ptr<llvm::TreePathPrefixMapper> Mapper;
888888
889+ // / The global file system cache.
890+ std::optional<
891+ clang::tooling::dependencies::DependencyScanningFilesystemSharedCache>
892+ SharedFilesystemCache;
893+
889894 // / A map from a String representing the target triple of a scanner invocation
890895 // / to the corresponding cached dependencies discovered so far when using this
891896 // / triple.
@@ -914,6 +919,19 @@ class SwiftDependencyScanningService {
914919 operator =(const SwiftDependencyScanningService &) = delete ;
915920 virtual ~SwiftDependencyScanningService () {}
916921
922+ // / Query the service's filesystem cache
923+ clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &getSharedCache () {
924+ assert (SharedFilesystemCache && " Expected a shared cache" );
925+ return *SharedFilesystemCache;
926+ }
927+
928+ // / Query the service's filesystem cache
929+ clang::tooling::dependencies::DependencyScanningFilesystemSharedCache &
930+ getSharedFilesystemCache () {
931+ assert (SharedFilesystemCache && " Expected a shared cache" );
932+ return *SharedFilesystemCache;
933+ }
934+
917935 bool usingCachingFS () const { return !UseClangIncludeTree && (bool )CacheFS; }
918936 llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem> getCachingFS () const { return CacheFS; }
919937
Original file line number Diff line number Diff line change @@ -427,6 +427,7 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
427427 /* CAS (llvm::cas::ObjectStore) */ nullptr ,
428428 /* Cache (llvm::cas::ActionCache) */ nullptr ,
429429 /* SharedFS */ nullptr );
430+ SharedFilesystemCache.emplace ();
430431}
431432
432433bool
Original file line number Diff line number Diff line change @@ -153,17 +153,6 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
153153 auto ClangModuleCachePath = getModuleCachePathFromClang (
154154 ScanASTContext.getClangModuleLoader ()->getClangInstance ());
155155 auto &FEOpts = ScanCompilerInvocation.getFrontendOptions ();
156-
157- // Configure the filesystem to use the same shared `stat` cache as the Clang
158- // worker uses.
159- if (!globalScanningService.CacheFS ) {
160- auto DepFS = llvm::makeIntrusiveRefCnt<
161- clang::tooling::dependencies::DependencyScanningWorkerFilesystem>(
162- globalScanningService.ClangScanningService ->getSharedCache (),
163- ScanASTContext.SourceMgr .getFileSystem ());
164- ScanASTContext.SourceMgr .setFileSystem (std::move (DepFS));
165- }
166-
167156 ModuleInterfaceLoaderOptions LoaderOpts (FEOpts);
168157 ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
169158 ScanASTContext.SourceMgr , &ScanASTContext.Diags ,
You can’t perform that action at this time.
0 commit comments