[PATCH] D145526: [clang][DependencyScanner] Cache modulemap stat failures

Michael Spencer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 14:48:12 PST 2023


Bigcheese created this revision.
Bigcheese added reviewers: ributzka, benlangmuir, jansvoboda11.
Bigcheese added a project: clang.
Herald added a project: All.
Bigcheese requested review of this revision.
Herald added a subscriber: cfe-commits.

Add `module.modulemap` as a file we cache stat failures for as there
are a lot of stats for this file.

Clang currently uses the files it should minimize as a proxy for files
it should cache stat failures for, but really we should cache stat
failures for all paths we don't expect to change during the build.
Unfortunately the VFS API does not know _why_ clang is trying to stat
a path, so we use the filename as a proxy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145526

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
@@ -181,7 +181,10 @@
   StringRef Ext = llvm::sys::path::extension(Filename);
   if (Ext.empty())
     return false; // This may be the module cache directory.
-  // Only cache stat failures on source files.
+  // Only cache stat failures on files that are not expected to change during
+  // the build.
+  if (Filename == "module.modulemap")
+    return true;
   return shouldScanForDirectivesBasedOnExtension(Filename);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145526.503157.patch
Type: text/x-patch
Size: 720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230307/c2207b53/attachment.bin>


More information about the cfe-commits mailing list