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

Dmitri Gribenko gribozavr at gmail.com
Tue Dec 4 07:17:41 PST 2012


On Tue, Dec 4, 2012 at 5:12 PM, Kevin Steiner <c934w-kev7gn4lc at yahoo.de> wrote:
> 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?

Hello Kevin,

If I understand you correctly, then TranslationUnitDecl is the root of
the tree you are looking for.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list