[cfe-users] Using Clang for CFG creation
jordan_rose at apple.com
Wed Mar 19 09:47:21 PDT 2014
Both DumpCFG and ViewCFG are meant as debug tools for working on the Clang static analyzer; in particular, the way the CFG is built for the analyzer may not match your needs.
If you are willing to write your own tool based on Clang's C++ interface, you can get a parsed AST and then ask for the CFG of any particular function using CFG::buildCFG. Note, though that the C++ API is not stable from release to release.
On Mar 19, 2014, at 6:28 , Hugues de Lassus <hugues.de-lassus at imag.fr> wrote:
> I was looking for exactly the same kind of tool. :)
> You may be interested by
> clang -cc1 -analyze -analyzer-checker=debug.ViewCFG test.cpp
> It generates a ps file in /tmp/ from a dot file which I cannot reach at the moment.
> On 03/19/2014 09:00 AM, Viktor Kaszian wrote:
>> 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.
>> cfe-users mailing list
>> cfe-users at cs.uiuc.edu
> Hugues de Lassus Saint-Geniès
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-users