For the past 5 years I have been using Gnu Compiler Collection (gcc/g++),so I'm a newbie for clang and I would like to generate a control flow graph for C/Objective C/C++ source code. Thankfully I have read here and here and found out I can get basic blocks representation of source-level statements by using the CFG class functions: CFG::buildCFG() CFG::dump()
which is great :) , but it's still unclear for me how do I get the function's body in AST form and ASTContext before passing it to buildCFG??
Can someone please give here a short snippet which demonstrates how do I export with clang a CFG for a given source code ?
Thank you all