[clang] [clang][modules] Dependency Scanning: Temporarily Turn Off Negative Directory Caching (PR #134698)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 10:44:29 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Qiongsi Wu (qiongsiwu)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/134698.diff


1 Files Affected:

- (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp (+7) 


``````````diff
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);

``````````

</details>


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


More information about the cfe-commits mailing list