[cfe-dev] AST parsing with CLang: get whole AST tree instead of events (like XML DOM instead of SAX) ?

Kevin Steiner c934w-kev7gn4lc at yahoo.de
Tue Dec 4 07:12:13 PST 2012


Hi,
i'd like to use CLang to parse c++ files to AST. The examples from https://github.com/loarabia/Clang-tutorial look nice, butI don't see any parsing to a structure that would hold the whole parsed AST (i.e. comparable to the DOM tree/document generated by DOM-based XML parsers).Instead, what I see is an event-based parsing API(comparable to SAX for XML parsers) where I subclass clang::ASTConsumer and my class gets events and has to store the tree structure itself somehow.

So before i do that(and probably re-invent the wheel in the process), I thought I'd better ask: is there some default tree structure that would save the whole parsed AST and that i can keep and use after the parsing is done (i.e. the AST equivalent of a DOM/XML DomDocument) and some easy way to automatically get that structure filled with the whole AST tree instead of getting events?

Best Regards,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121204/c54a0415/attachment.html>


More information about the cfe-dev mailing list