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 @@ -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 {
Original file line number Diff line number Diff 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
512513bool
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments