title: How to extract from source code a Control Flow Graph by using Clang?
body: <p>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 <a href="http://clang.llvm.org/docs/InternalsManual.html#conditional-control-flow" rel="nofollow">here</a> and <a href="http://adamrehn.com/articles/matching-cfg-blocks-to-basic-blocks/#generating-clang-source-level-cfgs" rel="nofollow">here</a> and found out I can get basic blocks representation of source-level statements by using the CFG class functions:
  CFG::buildCFG()
  CFG::dump()</p>
  
  <p>which is great :) , but it's <strong>still unclear</strong> for me how do I get the function's body in AST form and ASTContext before passing it to buildCFG??</p>
  
  <p>Can someone please <strong>give here a short snippet</strong> which demonstrates how do I export with clang a CFG for a given source code ?</p>
  
  <p>Thank you all</p>