[PATCH] D87450: [clangd] Implement hot index reloading for clangd-index-server

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 01:08:13 PDT 2020


kbobyrev added inline comments.


================
Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:234
+       LastStatus.getLastModificationTime(), Status->getLastModificationTime());
+  std::unique_ptr<clang::clangd::SymbolIndex> NewIndex = loadIndex(IndexPath);
+  if (!NewIndex) {
----------------
kadircet wrote:
> i think we should update `LastStatus` here, as we are going to fail loading the index unless the file changes. so there's no need to retry loading the index if the file hasn't changed.
Sorry, the comment is off, it belongs to the `if` statement above. Here, the index file is already different and there is an attempt to reload it. If it succeeds, new index replaces the old one and `LastStatus` is updated.


================
Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:342
+  HotReloadThread.join();
 }
----------------
kadircet wrote:
> nit: `return 0;` ?
No need for that in C++.

https://en.cppreference.com/w/cpp/language/main_function

> 4) The body of the main function does not need to contain the return statement: if control reaches the end of main without encountering a return statement, the effect is that of executing `return 0;`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87450



More information about the cfe-commits mailing list