Make sure to print labels on nodes without names
authorChris Lattner <sabre@nondot.org>
Wed, 22 Oct 2003 16:30:58 +0000 (16:30 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 22 Oct 2003 16:30:58 +0000 (16:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9376 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFGPrinter.cpp

index 4d6819d4fa4d67c16cc22a57fab7ab6307e882bd..ac93d4c1ca0afdb84520a57d5993be1ebbb64b17 100644 (file)
@@ -40,7 +40,8 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
 
   static std::string getNodeLabel(const BasicBlock *Node,
                                   const Function *Graph) {
-    if (CFGOnly && !Node->getName().empty()) return Node->getName() + ":";
+    if (CFGOnly && !Node->getName().empty())
+      return Node->getName() + ":";
 
     std::ostringstream Out;
     if (CFGOnly) {
@@ -48,6 +49,11 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
       return Out.str();
     }
 
+    if (Node->getName().empty()) {
+      WriteAsOperand(Out, Node, false, true);
+      Out << ":";
+    }
+
     Out << *Node;
     std::string OutStr = Out.str();
     if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());