================
@@ -50,8 +53,19 @@ struct ModuleCacheEntries {
   std::mutex Mutex;
   llvm::StringMap<std::unique_ptr<ModuleCacheEntry>> Map;
 
+  void addInvalidatedPath(StringRef Path);
+  bool isDirectoryInvalidated(StringRef Directory) const;
+  bool hasInvalidatedPaths() const {
+    return AnyInvalidatedPaths.load(std::memory_order_acquire);
+  }
+
   /// Flushes all PCMs built in-process to disk.
   void flush();
+
+private:
+  mutable std::mutex InvalidatedPathsMutex;
+  llvm::StringSet<> InvalidatedPaths;
----------------
ojhunt wrote:

I'd really prefer some more correct-by-construction interface here - do we have 
any existing idiomatic model? Something like 
`operate(std::function<R(llvm::StringSet<>&)> Fn) { lock(); 
Fn(InvalidatedPaths); }`  or anything? manual lock() + operate seems hazardous.

https://github.com/llvm/llvm-project/pull/229559
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to