[clang] [clang-tools-extra] clangd: Extend reference search with constructor calls through forwarding (PR #169742)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 16 22:55:03 PST 2025


================
@@ -101,6 +103,8 @@ class IndexASTConsumer final : public ASTConsumer {
   std::shared_ptr<IndexingContext> IndexCtx;
   std::shared_ptr<Preprocessor> PP;
   std::function<bool(const Decl *)> ShouldSkipFunctionBody;
+  bool DeferIndexingToEndOfTranslationUnit;
+  std::vector<DeclGroupRef> TopLevelDecls;
----------------
HighCommander4 wrote:

I don't think we need this. Instead, in `Initialize` we can save the `ASTContext*` to a field, and in `HandleTranslationUnit`, we can do:

```c++
for (auto *D : Context->getTranslationUnitDecl()->decls()) {
  IndexCtx->indexTopLevelDecl(D);
}
```

https://github.com/llvm/llvm-project/pull/169742


More information about the cfe-commits mailing list