Skip to content

Commit b6d0533

Browse files
authored
Merge pull request swiftlang#10116 from hjyamauchi/vfsusage
Exclude RedirectingFileSystem with null OverlayFileDir in VFSUsage
2 parents ee552f3 + a5e9f12 commit b6d0533

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,17 @@ std::vector<bool> HeaderSearch::collectVFSUsageAndClear() const {
150150

151151
llvm::vfs::FileSystem &RootFS = FileMgr.getVirtualFileSystem();
152152
// TODO: This only works if the `RedirectingFileSystem`s were all created by
153-
// `createVFSFromOverlayFiles`.
153+
// `createVFSFromOverlayFiles`. But at least exclude the ones with null
154+
// OverlayFileDir.
154155
RootFS.visit([&](llvm::vfs::FileSystem &FS) {
155156
if (auto *RFS = dyn_cast<llvm::vfs::RedirectingFileSystem>(&FS)) {
156-
VFSUsage.push_back(RFS->hasBeenUsed());
157-
RFS->clearHasBeenUsed();
157+
// Skip a `RedirectingFileSystem` with null OverlayFileDir which indicates
158+
// that they aren't created by createVFSFromOverlayFiles from the overlays
159+
// in HeaderSearchOption::VFSOverlayFiles.
160+
if (!RFS->getOverlayFileDir().empty()) {
161+
VFSUsage.push_back(RFS->hasBeenUsed());
162+
RFS->clearHasBeenUsed();
163+
}
158164
}
159165
});
160166
assert(VFSUsage.size() == getHeaderSearchOpts().VFSOverlayFiles.size() &&

0 commit comments

Comments
 (0)