File tree Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -886,11 +886,6 @@ 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-
894889 // / A map from a String representing the target triple of a scanner invocation
895890 // / to the corresponding cached dependencies discovered so far when using this
896891 // / triple.
@@ -919,19 +914,6 @@ class SwiftDependencyScanningService {
919914 operator =(const SwiftDependencyScanningService &) = delete ;
920915 virtual ~SwiftDependencyScanningService () {}
921916
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-
935917 bool usingCachingFS () const { return !UseClangIncludeTree && (bool )CacheFS; }
936918 llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem> getCachingFS () const { return CacheFS; }
937919
Original file line number Diff line number Diff line change @@ -426,7 +426,6 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
426426 /* CAS (llvm::cas::ObjectStore) */ nullptr ,
427427 /* Cache (llvm::cas::ActionCache) */ nullptr ,
428428 /* SharedFS */ nullptr );
429- SharedFilesystemCache.emplace ();
430429}
431430
432431bool
Original file line number Diff line number Diff line change @@ -153,6 +153,17 @@ 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+
156167 ModuleInterfaceLoaderOptions LoaderOpts (FEOpts);
157168 ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
158169 ScanASTContext.SourceMgr , &ScanASTContext.Diags ,
You can’t perform that action at this time.
0 commit comments