How do I generate a data flow graph with clang or other tools?

2.9k Views Asked by At

With clang and graphviz I can generate the calling graph for some C/C++ code as explained in this answer.

Now I need a data flow diagram computed on a really large codebase ( it's C for the most part ), this codebase is a software where cmake is used as building tool.

So my problem is, given the name of a data structure, how I can possibly retrieve the names of the functions and the files using/implementing this structure ?

There is some sparse reference to some data flow mining algorithms inside Libtool from the clang project ( not even sure if it's something stable or in development ), but I found nothing on clang itself or scan-build.

How I can generate this piece of information ? I really need just that, given a name I would like to retrieve where is used in the code, pretty much all the static analysis tools that I have reviewed are focusing on functions and methods, I need to check a data structure usage in clang.

EDIT:

I'm also considering using doxygen for the documentation, so if the xml output of doxygen could be useful for some tool, I can use it.

1

There are 1 best solutions below

4
On

You can query

  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • files including a file
  • and more.

with cscope.