[PATCH] D72647: [clangd] Only re-open files if their flags changed

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 14 00:17:57 PST 2020


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1125
   // Per-file update to the compilation database.
-  bool ShouldReparseOpenFiles = false;
+  std::set<std::string> ModifiedFiles;
+  auto Sub =
----------------
nit: llvm::StringSet<> or DenseSet<string> are the usual type here


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1126
+  std::set<std::string> ModifiedFiles;
+  auto Sub =
+      CDB->watch([&ModifiedFiles](const std::vector<std::string> Changes) {
----------------
this is a clever technique. (Why not just use compilationDatabaseChanges directly? I suppose because then you have to deal more with path canonicalization?)

it risks having the CDB change concurrently and reloading those files too, though.
I guess there's not much harm in it. But in that case, why aren't we just permanently subscribing to CDB changes and re-parsing affected files? Lack of a thread to do it on?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72647





More information about the cfe-commits mailing list