HighCommander4 wrote:

> So basically move the `HandleTopDeclaration` calls out of the for loop?

No; that is a method on `ASTConsumer`, which is a codebase-wide abstraction 
with many implementations, some of which expect that 
`ASTConsumer::HandleTopLevelDecl` is called as-you-parse.

(As a general rule, we rarely if ever want to be changing code in 
`clang/lib/Parse` for clangd purposes.)

I'm thinking more along the lines of changing how clangd's respective indexers 
make use of libIndex:

 * For the dynamic indexer, the entry point into libIndex is 
[`index::indexTopLevelDecls`](https://searchfox.org/llvm/rev/b97d24796c77818c7a951d0c535690c3c0035efe/clang-tools-extra/clangd/index/FileIndex.cpp#82),
 a simple function that loops over the decls of an already-fully-parsed AST and 
indexes them.
 * For the background indexer, we call 
[`index::createIndexingASTConsumer`](https://searchfox.org/llvm/rev/b97d24796c77818c7a951d0c535690c3c0035efe/clang-tools-extra/clangd/index/IndexAction.cpp#164)
 and do the indexing from the parser's callbacks to that `ASTConsumer`. I'm 
thinking we'll want to do it more the like the dynamic indexer.

https://github.com/llvm/llvm-project/pull/169742
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to