[cfe-dev] Control-Flow Graphs (CFGs)
kremenek at apple.com
Wed Aug 29 16:40:41 PDT 2007
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
A noteworthy feature of these CFGs is that they explicitly represent
• 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
More information about the cfe-dev