[clang] [llvm] [clang][deps] Add in-flight query caching to `DependencyScanningFilesystemSharedCache` (PR #199680)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 4 10:57:23 PDT 2026


================
@@ -204,6 +237,35 @@ class DependencyScanningFilesystemSharedCache {
     getOrInsertEntryForFilename(StringRef Filename,
                                 const CachedFileSystemEntry &Entry);
 
+    /// Claims a slot for \p Filename. If a resolved entry already exists,
+    /// returns it. If another worker is currently producing a result for this
+    /// filename, blocks on its \c InProgressEntry until done and returns the
+    /// produced entry. Otherwise installs a fresh \c InProgressEntry and
+    /// returns it as a producer slot which the caller must complete via
+    /// \c fulfilFilenameSlot.
+    SlotAcquisitionResult acquireFilenameSlot(StringRef);
+
+    /// Claims a slot for \p UID. Same semantics as \c acquireFilenameSlot but
+    /// keyed by unique ID; used after \c stat() has identified a file so that
+    /// concurrent \c readFile() calls for the same on-disk file (reached via
+    /// different filenames) collapse onto a single open.
+    SlotAcquisitionResult acquireUIDSlot(llvm::sys::fs::UniqueID);
+
+    /// Completes a producer slot acquired via \c acquireFilenameSlot.
+    /// Publishes \p Result under \p Filename in \c CacheByFilename,
+    /// records it in the slot, marks the slot done, removes the
+    /// in-progress entry, and notifies waiters.
+    void fulfilFilenameSlot(StringRef, const std::shared_ptr<InProgressEntry> &,
----------------
jansvoboda11 wrote:

TIL both spellings are correct 😅

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


More information about the cfe-commits mailing list