fix callgraph dump to not print 0x0x1234 for nodes.
authorChris Lattner <sabre@nondot.org>
Fri, 23 Apr 2010 18:23:40 +0000 (18:23 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 23 Apr 2010 18:23:40 +0000 (18:23 +0000)
Add the instruction pointer value for debuggability.
We now get dump output that looks like this:

Call graph node for function: 'f1'<<0x1017086b0>>  #uses=1
  CS<0x1017046f8> calls external node

Call graph node for function: '_ZNSt6vectorIdSaIdEEC1EmRKdRKS0_'<<0x1017086f0>>  #uses=1
  CS<0x0> calls external node

Call graph node for function: 'f4'<<0x1017087a0>>  #uses=1
  CS<0x101708c88> calls function 'f3'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102194 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IPA/CallGraph.cpp

index 62a4c31e3bde723abd2ab17b08bb53300eb9d9dd..2bde56d718896e2608f0a9d774ab840dfbebfa70 100644 (file)
@@ -244,14 +244,16 @@ void CallGraphNode::print(raw_ostream &OS) const {
   else
     OS << "Call graph node <<null function>>";
   
-  OS << "<<0x" << this << ">>  #uses=" << getNumReferences() << '\n';
+  OS << "<<" << this << ">>  #uses=" << getNumReferences() << '\n';
 
-  for (const_iterator I = begin(), E = end(); I != E; ++I)
+  for (const_iterator I = begin(), E = end(); I != E; ++I) {
+    OS << "  CS<" << I->first << "> calls ";
     if (Function *FI = I->second->getFunction())
-      OS << "  Calls function '" << FI->getName() <<"'\n";
-  else
-    OS << "  Calls external node\n";
-  OS << "\n";
+      OS << "function '" << FI->getName() <<"'\n";
+    else
+      OS << "external node\n";
+  }
+  OS << '\n';
 }
 
 void CallGraphNode::dump() const { print(dbgs()); }