Clang to flowchart

> I want to produce some flowcharts and workflows from a complex
> multit-hreaded C++ codebase.
> I was thinking that gcc-xml might be useful so I asked on the mailing
> list, and they suggested that Clang might be a useful option.
> Are there any tools based on Clang that can produce flowcharts/workflows
> so I can get a better picture of how the complex multit-hreaded C++
> operates ??

Internally, Clang has the facilities to build a control-flow graph. You could build on top of that.

> Is there suitable output from Clang about all the function calls, etc
> (e.g. in xml format) that can be used to generate UML or flowcharts or
> other documents ??

Clang has an XML format, but it's not rich enough to be useful for this purpose.

I'm not familiar with the Clang codebase at all, so if someone could
point me to the parts of the code that would be a starting point to
build a control-flow graph then that be a great benefit.

If anyone has any ideas for on implementation for such a feature I would
also be keen to hear them.

Cheers, Brendan.

Hi Brendan,

There's a couple places you can look. CFG.h contains the raw APIs to construct a CFG from a Decl* (which could be a FunctionDecl*, and ObjCMethodDecl*, etc.). AnalysisContext provides a nice wrapper API for constructing and destroying CFGs, as well as querying other useful analyses. The latter is used in AnalysisBasedWarnings.cpp (in libSema), as well as the static analyzer.

Note that CFG support for C++ is still a WIP.