[PATCH] D82891: [clangd] Fix race in FileIndex that sometimes temporarily lost updates.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 02:39:51 PDT 2020


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:269
+
+    ++this->Version;
+    if (Version)
----------------
Bumping the version in `update` and just exposing it in `buildIndex` feels more natural, WDYT?

Might even enable us to get rid of some redundant resets (not that it is expensive ..), imagine a sequencing like:

- update1
- update2
- buildIndex1
- buildIndex2

even though both build the same index, they got different version numbers hence both will reset the current index.


================
Comment at: clang-tools-extra/clangd/index/Symbol.h:190
+  using size_type = size_t;
+  size_type size() const { return Symbols.size(); }
   bool empty() const { return Symbols.empty(); }
----------------
i suppose this is for `testing::SizeIs` right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82891





More information about the cfe-commits mailing list