[PATCH] D125859: [clang][deps] stop reusing FileManager in DependencyScanningAction
Shi Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 18 01:20:52 PDT 2022
Kale created this revision.
Herald added a project: All.
Kale requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
DepFS already provides necessary caching, so explicitly stop reusing the FileMgr for possibly cache conflict.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125859
Files:
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
+#include "clang/Basic/FileManager.h"
#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
@@ -197,10 +198,14 @@
for (const auto &F : ScanInstance.getHeaderSearchOpts().VFSOverlayFiles)
DepFS->disableMinimization(F);
- // Support for virtual file system overlays on top of the caching
- // filesystem.
- FileMgr->setVirtualFileSystem(createVFSFromCompilerInvocation(
- ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS));
+ // DepFS already provides caching, so we don't need to reuse FileManager.
+ // The provided FileManger is abandoned for possibly invalid caches caused
+ // by the change of VFS.
+ auto VFS = createVFSFromCompilerInvocation(
+ ScanInstance.getInvocation(), ScanInstance.getDiagnostics(), DepFS);
+ FileMgr = new FileManager(FileMgr->getFileSystemOpts(), VFS);
+ ScanInstance.setFileManager(FileMgr);
+ ScanInstance.createSourceManager(*FileMgr);
// Pass the skip mappings which should speed up excluded conditional block
// skipping in the preprocessor.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125859.430269.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220518/7d31275d/attachment.bin>
More information about the cfe-commits
mailing list