Whole program analysis using LTO

I want to do an inter-module analysis of a C project which contains multiple C files.

I’ve written the pass as an extension of the ModulePass but I cannot get the information about other modules. I was looking into it and there seems to be a way to do it via Link Time Optimization (LTO). But I was not able to find an example on how to write an analysis pass for such optimization. All the examples just mention how to compile the code using LTO i.e, passing “-flto” and “-fuse-ld=gold” to clang. Can anybody point me to some example on how to write pass for LTO?

The requirement can be seen as generating the CallGraph along with the CFG for the whole project. The project uses Makefile to generate executable.