Skip to content

Exclude RedirectingFileSystem with null OverlayFileDir in VFSUsage #10116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions clang/lib/Lex/HeaderSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ 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 from the overlays
// in HeaderSearchOption::VFSOverlayFiles.
if (!RFS->getOverlayFileDir().empty()) {
VFSUsage.push_back(RFS->hasBeenUsed());
RFS->clearHasBeenUsed();
}
}
});
assert(VFSUsage.size() == getHeaderSearchOpts().VFSOverlayFiles.size() &&
Expand Down