[clang] Exclude RedirectingFileSystem with null OverlayFileDir in VFSUsage (PR #128267)
Michael Spencer via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 14:13:05 PST 2025
================
@@ -149,11 +149,16 @@ std::vector<bool> HeaderSearch::collectVFSUsageAndClear() const {
llvm::vfs::FileSystem &RootFS = FileMgr.getVirtualFileSystem();
// TODO: This only works if the `RedirectingFileSystem`s were all created by
- // `createVFSFromOverlayFiles`.
+ // `createVFSFromOverlayFiles`. But at least exclude the ones with null
+ // OverlayFileDir.
RootFS.visit([&](llvm::vfs::FileSystem &FS) {
if (auto *RFS = dyn_cast<llvm::vfs::RedirectingFileSystem>(&FS)) {
- VFSUsage.push_back(RFS->hasBeenUsed());
- RFS->clearHasBeenUsed();
+ // Skip a `RedirectingFileSystem` with null OverlayFileDir which indicates
+ // that they aren't created by `createVFSFromOverlayFiles`.
----------------
Bigcheese wrote:
I think it would be better if this comment said something about `HeaderSearchOption::VFSOverlayFiles`, as that's what `VFSUsage` is really trying to represent. Something like:
"... which indicates that they aren't created by `createVFSFromOverlayFiles` from the overlays in `HeaderSearchOption::VFSOverlayFiles`."
https://github.com/llvm/llvm-project/pull/128267
More information about the cfe-commits
mailing list