[cfe-dev] [RFC] A C++ pseudo parser for tooling

Argyrios Kyrtzidis via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 12 15:55:59 PST 2021


Hi, 

> On Nov 5, 2021, at 6:37 AM, Haojian Wu via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> We’d like to propose a pseudo-parser which can approximately parse C++ (including broken code). It parses a file in isolation, without needing headers, compile flags etc. Ambiguities are resolved heuristically, like clang-format. Its output is a clang::syntax tree, which maps the token sequence onto the C++ grammar.
> Our motivation comes from wanting to add some low latency features (file outline, refactorings etc) in clangd, but we think this is a useful building block for other tools too.

This is quite interesting and exciting!

> On Nov 9, 2021, at 6:34 AM, Sam McCall via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> The idea for clangd is to augment (not replace) this index with a pseudo-parser based index that processes each file once. It would be halfway between the AST index and grep. This index would provide the same operations with lower fidelity, and would be replaced by the AST-based index as it completes.

Could you provide more details about this part, how will both sources be combined together?

E.g. is clangd always using the pseudo-index only until the AST one completes completely, at which points it switches to the AST one (so either one or the other exclusively), or does it mix the info from both? Are the data structures and storage different and separate (and with separate APIs?) or are the indexing info representation and storage shared and they mainly differ in how they derive the indexing information?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211112/d197a908/attachment-0001.html>


More information about the cfe-dev mailing list