[clang] Exclude RedirectingFileSystem with null OverlayFileDir in VFSUsage (PR #128267)

Hiroshi Yamauchi via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 24 17:40:04 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`.
----------------
hjyamauchi wrote:

Done

https://github.com/llvm/llvm-project/pull/128267


More information about the cfe-commits mailing list