[cfe-dev] How to write a program using clang libraries to generate the AST and the CFG of C source code

Raymond Chen chyx06 at hotmail.com
Wed Apr 27 18:08:04 PDT 2011


Hello,

I am trying to write a program using clang libraries to generate the AST and
the CFG of C source code, For example,

int foo(int x){

x=x+1;

if(x>2)x++;

else{

x+=2;

x*=2;

}

return x;

}

Using "clang -cc1 -ast-dump foo.c" can generate the AST of foo.c

Using "clang -cc1 -analyze -analyzer-checker=debug.DumpCFG foo.c" can
generate the CFG of foo.c

But I don`t know which libraries should be used and I don`t know how to
write my own program using the libraries to generate the AST and the CFG of
C source code

Are there any documents about how to use the libraries?

 

 

Besh Wishes

Raymond Chen

ECNU

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110428/3a3e0ca5/attachment.html>


More information about the cfe-dev mailing list