[PATCH] D92155: Load plugins when creating a CompilerInvocation.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 06:22:31 PST 2020


sammccall added a comment.

In D92155#2419667 <https://reviews.llvm.org/D92155#2419667>, @psionic12 wrote:

>> - main file AST build: Important to run plugins here but it's critical they don't traverse the whole preamble (can degrade latency by orders of magnitude).
>
> Well, Sound reasonable, but what if `getTranslationUnitDecl()` is indeed needed instead of using `TraverseAST` (I didn't came up with an example yet)? In this case I think clangd should allow a plugin to do its job, even if it is performance hostile.

To a first approximation, I think we *should* disable features that don't perform well, as the overall responsiveness is more important than any one feature.
We make numerous functionality tradeoffs in clangd consistent with this.

As a practical concern, I'm not sure what we can reasonably do to enforce this though.

(One idea we've been playing with is that traversal of the AST usually goes through TranslationUnitDecls::decls_begin(), which triggers loading from the preamble. We could add a stateful flag to DeclContext that causes this to behave like noload_decls_begin instead...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92155



More information about the cfe-commits mailing list