[clang] [llvm] [clang][deps] Overload `Filesystem::exists` in `DependencyScanningFilesystem` to have it use cached `status` (PR #88152)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 09:25:20 PDT 2024


================
@@ -270,6 +270,12 @@ DependencyScanningWorkerFilesystem::status(const Twine &Path) {
   return Result->getStatus();
 }
 
+bool
+DependencyScanningWorkerFilesystem::exists(const Twine &Path) {
+  llvm::ErrorOr<llvm::vfs::Status> Status = status(Path);
----------------
jansvoboda11 wrote:

The one from Ben's commit: using `exists()` instead of `status()` can be implemented more efficiently on some VFSs. It can be surprising that `DependencyScanningWorkerFilesystem` just throws that out of the window. But it's typically wrapped around `RealFileSystem` that doesn't specialize `exists()`, and we could not cache the result of just `exists()` here anyway.

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


More information about the cfe-commits mailing list