https://github.com/qiongsiwu created 
https://github.com/llvm/llvm-project/pull/134698

55323ca6c8b9d21d85591f3499b299b62463321f implemented negative caching of 
directories. The implementation may be too aggressive in certain cases, and may 
lead to file not found errors even if the files exist on disk. 

This PR temporarily turns off negative directory caching to fix the build 
failures. 

rdar://148027982

>From 5d64a6090d4f16fe9109821c73295db253a5af1b Mon Sep 17 00:00:00 2001
From: Qiongsi Wu <qiongsi...@apple.com>
Date: Mon, 7 Apr 2025 10:04:03 -0700
Subject: [PATCH] Initial fix.

---
 .../DependencyScanning/DependencyScanningFilesystem.cpp    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp 
b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
index 4d738e4bea41a..805409046cf54 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
@@ -241,6 +241,13 @@ DependencyScanningWorkerFilesystem::computeAndStoreResult(
   llvm::ErrorOr<llvm::vfs::Status> Stat =
       getUnderlyingFS().status(OriginalFilename);
   if (!Stat) {
+    // rdar://148027982
+    // Negative caching directories can cause build failures.
+    // FIXME: we should remove the check below once we know
+    // the build failures' root causes.
+    if (llvm::sys::path::extension(OriginalFilename).empty())
+      return Stat.getError();
+
     const auto &Entry =
         getOrEmplaceSharedEntryForFilename(FilenameForLookup, Stat.getError());
     return insertLocalEntryForFilename(FilenameForLookup, Entry);

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to