[PATCH] D108119: Wiring of standard library indexing into clangd.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 17 05:39:27 PDT 2021


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:180
+  if (Opts.IndexStandardLibrary) {
+    auto SLIndex = indexStandardLibrary(TFS);
+    if (!SLIndex) {
----------------
A couple of issues with indexing here and placing it in the stack:

1. it's synchronous and blocks all other operations, we shouldn't do that. This is a latency sensitive path: the user just opened the first file in their editor. Our usual trick here is using a SwapIndex as a placeholder and loading asynchronously, but...

2. there's no way to disable it or use a different configuration for e.g. C files, or according to config.

I think ultimately the triggering logic will want to live in TUScheduler so it can be sensitive to CompilerInvocation (and thus LangOpts) as well as config. Essentially it will wrap ParseInputs.Index after calling buildCompilerInvocation.

That's more complicated to get right, and if you want to delay it and still be able to use this locally it makes sense. Some FIXME comments should describe how this needs to be moved before the feature is usable by end-users though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108119



More information about the cfe-commits mailing list