Call Graph Exploration using Clang libraries?

Hi all,

(if this is not the right list to ask this question please point me to the correct location)

I'm trying to build a call graph visualization for Objective-C/C/C++ based projects, and wondering whether Clang is the right tool to use and how to determine whether it is. However, I wasn't able to do so, so far.
Basically, I'm looking for a library to stick a bunch of source code files in and get a call graph out (I know that the exact definition of the call graph might vary and calculating the actual executable call graph is undecidable, but a basic version, which just recognizes what method contains a call to another method, would be fine).

I read most of http://clang.llvm.org/, including the "Clang Internals", "Hacking on Clang" and "User's Manual" and the only thing that comes close to what I need is the CFG class ( http://clang.llvm.org/docs/InternalsManual.html#CFG ), but that seems to be still quite far from what I need.

I also found a mail on this list ( http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-September/017569.html ) talking about the CallGraph class ( http://clang.llvm.org/doxygen/classclang_1_1CallGraph.html ). That sounds more like it but the Doxygen doesn't give much information about what this class represents exactly and how it should be used. (Or maybe it does and I don't understand it ^^)

So I have two (sets of) questions:
1. Do you think Clang is the right tool for what I want to achieve (extract a call graph from source code)? How much of this Call Graph creation from source code is already done by Clang and how much of it would I have to do myself (pointing me to resources where I can find the answer is fine as a replacement for an answer :wink: )?

2. If Clang is the right tool to use, how and where can I learn how to use Clang for my purpose? What I found so far is either about taking part in the development of Clang itself or how to use Clang from the command line. I couldn't find a good description on how to get started using Clang as a library in another program. I found the description about the different libraries here: http://clang.llvm.org/features.html#libraryarch But that's about it and I still don't really understand which of these libraries I would actually need. I would be grateful if you could provide me with a link to a resource that explains how to get started using Clang as a library. It would be great if this getting started would actually go in the direction of call graph parsing.

Best regards,

Joachim

P.S. I don't have much experience with C++ or Compilers, so some of my confusion might come from this limited knowledge. I plan to write an Objective-C call graph visualization in Objective-C, but Clang seems to be a great parser/compiler/analyzer so I'd like to use it.