I’ve had making something like this in mind for quite some time, but nothing this sophisticated. I’m glad someone else has solved my little problem.
It actually seems to work. I had to rebuild the entirety of LLVM within a schroot and toy around with CMake to get it working on our project at work at all but hey. It also seems to directly open the terminal, so I was initially unable to redirect it to a file, but that can be circumvented:
script -c "make -k" include-what-you-use-output
Then you can use less -R to view it. That’s what comes to my mind immediately anyway.
We’ve made great use of this in our quest to improve the codebase. By making dependencies explicit, rather than third order includes of includes, it’s dramatically easier see what’s been put in the wrong place.