LibTooling and Control Flow Analyses

Hi all,

I've implemented a control-flow based analysis by deriving a CFG from an
AnalysisDeclContext. For fixed-point iteration I've used the
ForwardDataflowWorklist. The whole analysis is implemented directly
into clang which may emit a couple of warnings during compilation.
However, the analysis is actually independent and could therefore run on
its own. Thus I thought it would be also nice to have a standalone tool
which led me to LibTooling.

Everything I read so far about LibTooling was about walking over the
AST. Is it also possible to derive a CFG in LibTooling (maybe from an
ASTContext)?

Cheers,
Stefan

Yes you can build the CFG in libTooling using CFG::buildCFG by passing the ASTContext and the Stmt for which you want the CFG.

That works perfectly. Thanks for the hint!

Cheers,
Stefan

You’re welcome,

Cheers,
Andi