Skip to content

Commit e17e147

Browse files
committed
[Dependency Scanning] Use a standalone DependencyScanningFilesystem on the scanner, sharing a common status cache from Clang's dependency service cache
1 parent a2d5ac8 commit e17e147

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/DependencyScan/ModuleDependencyScanner.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
llvm::IntrusiveRefCntPtr<
160+
clang::tooling::dependencies::DependencyScanningWorkerFilesystem>
161+
DepFS =
162+
new clang::tooling::dependencies::DependencyScanningWorkerFilesystem(
163+
globalScanningService.ClangScanningService->getSharedCache(),
164+
ScanASTContext.SourceMgr.getFileSystem());
165+
ScanASTContext.SourceMgr.setFileSystem(std::move(DepFS));
166+
156167
ModuleInterfaceLoaderOptions LoaderOpts(FEOpts);
157168
ScanningASTDelegate = std::make_unique<InterfaceSubContextDelegateImpl>(
158169
ScanASTContext.SourceMgr, &ScanASTContext.Diags,

0 commit comments

Comments
 (0)