[PATCH] D77847: [clangd] Rebuild dependent files when a header is saved.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 04:49:21 PDT 2020


kadircet added a comment.

should we also have a unittest for checking ast caching works as expected?

ClangdServer::getUsedBytesPerFile should allow us to do that.

We can set cache size to one, send 3 updates in respective order to foo, bar and baz, we record usedbytesperfile.
Then we perform adddocument with same contents to foo and bar and check usedbytesperfile are still the same?



================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:575
+                 {"change", (int)TextDocumentSyncKind::Incremental},
+                 {"save", true},
+             }},
----------------
spec also specifies this as `property name (optional): textDocumentSync.didSave` near didSave notification (in addition to defining it as `save` in the struct). :(

it also says textDocumentSync can also be a number for backward compat reasons, but doesn't say when the struct was added. I hope it is not recent and we don't end up breaking clients with our capab response :/

no action needed just complaining ...


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1587
   // Reparse only opened files that were modified.
   for (const Path &FilePath : DraftMgr.getActiveFiles())
+    if (Filter(FilePath))
----------------
nit: while here, braces and early exit.

```
for (..) {
  if(!Filter())
    continue;
  if(auto draft...) server->AddDoc();
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77847





More information about the cfe-commits mailing list