clang now has support for source level control-flow graphs (CFGs). You can see them in action now by checking out the following new command-line options to the clang driver:
• -dump-cfg: builds ASTs and then CFGs. CFGs are then pretty-printed.
• -view-cfg: builds ASTs and then CFGs. CFGs are then visualized by invoking Graphviz.
A noteworthy feature of these CFGs is that they explicitly represent control-flow for:
• The ternary ? operator
• Short-circuit operators '&&' and '||'
• GCC-style "indirect" gotos (via taking the address of a label).
We are still working out the details of CFGs, but the interface/API for CFGs can be found in 'include/AST/CFG.h'. More features (and bug-fixes) are likely to be added/made in the short-term.
NOTE: For help on getting Graphviz to work with clang/LLVM, see: http://llvm.org/docs/ProgrammersManual.html#ViewGraph