Make the print output more useful
authorChris Lattner <sabre@nondot.org>
Mon, 15 Sep 2003 04:29:37 +0000 (04:29 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Sep 2003 04:29:37 +0000 (04:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8517 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IPA/CallGraph.cpp

index 34475e18c99a83cda3c7b5b8f3854ae9add2407f..980d11961e7d4b70b5875fc742da0e91a2b953b4 100644 (file)
@@ -135,7 +135,7 @@ static void WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
     o << "Call graph node for function: '"
       << CGN->getFunction()->getName() <<"'\n";
   else
-    o << "Call graph node null function:\n";
+    o << "Call graph node <<null function: 0x" << CGN << ">>:\n";
 
   for (unsigned i = 0; i < CGN->size(); ++i)
     if ((*CGN)[i]->getFunction())
@@ -146,8 +146,12 @@ static void WriteToOutput(const CallGraphNode *CGN, std::ostream &o) {
 }
 
 void CallGraph::print(std::ostream &o, const Module *M) const {
-  o << "CallGraph Root is:\n" << getRoot();
-
+  o << "CallGraph Root is: ";
+  if (getRoot()->getFunction())
+    o << getRoot()->getFunction()->getName() << "\n";
+  else
+    o << "<<null function: 0x" << getRoot() << ">>\n";
+  
   for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I)
     WriteToOutput(I->second, o);
 }