================
@@ -141,6 +141,22 @@ std::vector<bool> HeaderSearch::computeUserEntryUsage() 
const {
   return UserEntryUsage;
 }
 
+std::vector<bool> HeaderSearch::computeVFSUsageAndClear() const {
+  std::vector<bool> VFSUsage;
+  llvm::vfs::FileSystem &RootFS = FileMgr.getVirtualFileSystem();
+  // TODO: This only works if the `RedirectingFileSystem`s were all created by
+  //       `createVFSFromOverlayFiles`.
+  RootFS.visit([&](llvm::vfs::FileSystem &FS) {
+    if (auto *RFS = dyn_cast<llvm::vfs::RedirectingFileSystem>(&FS)) {
+      VFSUsage.push_back(RFS->hasBeenUsed());
+      RFS->clearHasBeenUsed();
+    }
+  });
+  // VFS visit order is the opposite of VFSOverlayFiles order.
+  std::reverse(VFSUsage.begin(), VFSUsage.end());
+  return VFSUsage;
----------------
jansvoboda11 wrote:

Might be worth asserting that size of `VFSUsage` is the same as the size of 
`HeaderSearchOptions::VFSOverlayFiles`.

https://github.com/llvm/llvm-project/pull/73734
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to