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 {
886
886
// / File prefix mapper.
887
887
std::unique_ptr<llvm::TreePathPrefixMapper> Mapper;
888
888
889
- // / The global file system cache.
890
- std::optional<
891
- clang::tooling::dependencies::DependencyScanningFilesystemSharedCache>
892
- SharedFilesystemCache;
893
-
894
889
// / A map from a String representing the target triple of a scanner invocation
895
890
// / to the corresponding cached dependencies discovered so far when using this
896
891
// / triple.
@@ -919,19 +914,6 @@ class SwiftDependencyScanningService {
919
914
operator =(const SwiftDependencyScanningService &) = delete ;
920
915
virtual ~SwiftDependencyScanningService () {}
921
916
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
-
935
917
bool usingCachingFS () const { return !UseClangIncludeTree && (bool )CacheFS; }
936
918
llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem> getCachingFS () const { return CacheFS; }
937
919
Original file line number Diff line number Diff line change @@ -426,7 +426,6 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
426
426
/* CAS (llvm::cas::ObjectStore) */ nullptr ,
427
427
/* Cache (llvm::cas::ActionCache) */ nullptr ,
428
428
/* SharedFS */ nullptr );
429
- SharedFilesystemCache.emplace ();
430
429
}
431
430
432
431
bool
Original file line number Diff line number Diff line change @@ -153,6 +153,17 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
153
153
auto ClangModuleCachePath = getModuleCachePathFromClang (
154
154
ScanASTContext.getClangModuleLoader ()->getClangInstance ());
155
155
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
+
156
167
ModuleInterfaceLoaderOptions LoaderOpts (FEOpts);
157
168
ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
158
169
ScanASTContext.SourceMgr , &ScanASTContext.Diags ,
You can’t perform that action at this time.
0 commit comments