[cfe-users] Using Clang for CFG creation

Viktor Kaszian kaszian at cs.uni-bonn.de
Wed Mar 19 01:00:09 PDT 2014


Hi everyone!

I'm currently working on a project for which i need a way to parse c/c++ 
source code and convert it into a CFG.

I happened upon Clang just a few days ago, and have been trying to 
figure out how to use it to create my CFG, but i failed. All i can use 
Clang for at the moment is using

clang -cc1 -analyze -analyzer-checker=debug.DumpCFG test.cpp

But this only yields a textual representation. Worst case i could write 
a parser for the output. I would much prefer to find a way to extract 
the CFG as it is used within Clang to my application.

The best would be if i could just call a function in Clang from my 
application and get the CFG returned.

Thanks for your time and answers. It is much appreciated.
Viktor



More information about the cfe-users mailing list