Building and inspecting CFGs

Hi everyone,

I am trying to build a C static analysis tool and in order to make some procedures I need to build Control Flow Graphs. I am using clang for parsing the c files and building the AST, in particular I am working with python bindings. I was wondering if there is any way to build and interact with a Control Flow Graph in the same way I can do it throught the AST with pyhton bindings.
I inspected the files and I realized that with python bindings this is not possible (maybe I am wrong since I am a little newbie). Maybe exist another way to do it, can you help me with that?

Thank you so much, I hope this is the right place for this type of questions.

Hello,

In Clang tools, you can use CFG class (search for CFG.cpp, CFG.h). However, I'm not sure if it is available with Python bindings.

23.05.2016 22:28, shr dev via cfe-dev пишет:

Hello,

In Clang tools, you can use CFG class (search for CFG.cpp, CFG.h).
However, I'm not sure if it is available with Python bindings.

23.05.2016 22:28, shr dev via cfe-dev пишет:

Hi everyone,

I am trying to build a C static analysis tool and in order to make
some procedures I need to build Control Flow Graphs. I am using clang

There's already a bunch of infrastructure in place for this... are you sure you want to start from scratch? (It uses the CFG infra that Alexey mentioned).

http://clang-analyzer.llvm.org/

Jon

Thank you for quickly answering my question. it seems like the static analysis tool interface is the better way to perform this task. After reading the CFG.cpp and CFG.h I think that building the CFG on my own from the AST can be a big amount of work and a little bit tedious.