[PATCH] D50847: [clangd] Add callbacks on parsed AST in addition to parsed preambles

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 05:13:00 PDT 2018


hokein added a comment.

Thanks for adding it.



================
Comment at: clangd/TUScheduler.cpp:406
     // We only need to build the AST if diagnostics were requested.
     if (WantDiags == WantDiagnostics::No)
       return;
----------------
The AST might not get built if `WantDiags::No`, and will be built in `runWithAST`.


================
Comment at: clangd/TUScheduler.h:66
+  /// instead.
+  virtual void onMainAST(PathRef Path, ParsedAST &AST) = 0;
+};
----------------
Does the callback get called every time we built an AST? clangd only has 3 idle ASTs, if the AST is not there, we rebuild it when needed (even the source code is not changed), and we will update the dynamic index, which seems unnecessary.

It may rarely happen, 3 idle ASTs  might cover most cases, I think? 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50847





More information about the cfe-commits mailing list