4

How do I use clang to generate a call graph of C++ code? I understand I need to use this, but I can't find any examples.

I already tried using python bindings for this, but they seem to be lacking some important functions.

Can anyone provide a minimal example of using current clang's API for this task?

user1367401
  • 1,030
  • 17
  • 26

1 Answers1

2

For C++ (For C just use clang)

clang++ -Xclang -analyze -Xclang -analyzer-checker=debug.ViewCallGraph <file to analyze>

This will get you images.

RedX
  • 14,749
  • 1
  • 53
  • 76