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 {
982
982
// / File prefix mapper.
983
983
std::unique_ptr<llvm::TreePathPrefixMapper> Mapper;
984
984
985
+ // / The global file system cache.
986
+ std::optional<
987
+ clang::tooling::dependencies::DependencyScanningFilesystemSharedCache>
988
+ SharedFilesystemCache;
989
+
985
990
// / A map from a String representing the target triple of a scanner invocation
986
991
// / to the corresponding cached dependencies discovered so far when using this
987
992
// / triple.
@@ -1011,6 +1016,19 @@ class SwiftDependencyScanningService {
1011
1016
operator =(const SwiftDependencyScanningService &) = delete ;
1012
1017
virtual ~SwiftDependencyScanningService () {}
1013
1018
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
+
1014
1032
bool usingCachingFS () const { return !UseClangIncludeTree && (bool )CacheFS; }
1015
1033
llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem>
1016
1034
getCachingFS () const {
Original file line number Diff line number Diff line change @@ -507,6 +507,7 @@ SwiftDependencyScanningService::SwiftDependencyScanningService() {
507
507
/* CAS (llvm::cas::ObjectStore) */ nullptr ,
508
508
/* Cache (llvm::cas::ActionCache) */ nullptr ,
509
509
/* SharedFS */ nullptr );
510
+ SharedFilesystemCache.emplace ();
510
511
}
511
512
512
513
bool
Original file line number Diff line number Diff line change @@ -173,17 +173,6 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
173
173
auto ClangModuleCachePath = getModuleCachePathFromClang (
174
174
ScanASTContext.getClangModuleLoader ()->getClangInstance ());
175
175
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
-
187
176
ModuleInterfaceLoaderOptions LoaderOpts (FEOpts);
188
177
ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
189
178
ScanASTContext.SourceMgr , &ScanASTContext.Diags ,
You can’t perform that action at this time.
0 commit comments