[PATCH] D92381: [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 00:46:21 PST 2020


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp:91
+  // Whether a new CDB has been loaded but not broadcast yet.
+  bool Dirty = false;
+  // Last loaded CDB, meaningful if CachePopulated is set.
----------------
kadircet wrote:
> maybe rename this to `DidBroadcast` if we are not planning to add extra meaning to `Dirty` in the near future?
Renamed to `NeedsBroadcast`.

(`DidBroadcast` isn't quite right once we can reload databases and thus need to broadcast again)


================
Comment at: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp:119
+    if (CachePopulated) {
+      ShouldBroadcast = Dirty;
+      Dirty = false;
----------------
kadircet wrote:
> what if caller is not willing to broadcast?
Good catch, thanks.

Changed the handling of ShouldBroadcast to always flow via NeedsBroadcast, which is set by load().


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92381/new/

https://reviews.llvm.org/D92381



More information about the cfe-commits mailing list