[cfe-dev] Question about printing abstract syntax tree in Clang

Yang Ye yeyangever at gmail.com
Sun Jun 27 22:55:51 PDT 2010


Another question please, can anyone help describe, if I have a class
definition in C++, what will it be like in the parsed result ----
abstract syntax tree?

Say for the class definition:

class A{
   int a;
   int b;
   bool c;
}

what will it be like in the parsed resulted AST?


Thank you!


-----------------------
Yang Ye
646-417-0326

Ph.D.
Department of Computer Science
The Fu Foundation School of Engineering and Applied Science Columbia University
yy2314 at columbia.edu



On Sun, Jun 27, 2010 at 10:17 PM, Yang Ye <yeyangever at gmail.com> wrote:
> Hello everyone,
>
> This is Yang Ye, a new researcher working on Clang. I want to use
> clang to print out the abstract syntax tree in a human readable, not
> getting the binary bytecode one.
> Can anyone show me how to use the API to do it?
>
>
>
> Another question, I found some sample code on the website about
> dumping the CFG, it uses:
>
>   Stmt* FooBody = ...
>   CFG* FooCFG = CFG::buildCFG(FooBody);
>  FooCFG->dump():
>
> This is also helpful, but how can I construct a statement from give code?
>
>
> Thanks a lot
>
> -----------------------
> Yang Ye
> 646-417-0326
>
> Ph.D.
> Department of Computer Science
> The Fu Foundation School of Engineering and Applied Science Columbia University
> yy2314 at columbia.edu
>




More information about the cfe-dev mailing list