Trouble traversing the CallGraph

I am finding some weird behavior in the CallGraph, and am not sure what am I doing wrong. When trying to traverse nodes
in the CallGraph I get stuck in nodes representing external functions. Take the following code:

I solved this problem after some painful debugging. VHAsserting, defined in ValueHandler.h and used by CallGraphNode,
behaves differently depending on whether NDEBUG is defined or not. My LLVM was compiled using NDEBUG,
while the pass I was using was not. This explains why calling CallGraph::dump() worked while implementing it in
user code failed, among other scary inconsistencies. It had nothing to do with the CallGraph including external
functions whatsoever, as I had previously thought.

To summarize, it is a good idea to use the Makefile.common in tne LLVM top-level directory (if available) to build your
passes, as stated in the documentation.