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