summaryrefslogtreecommitdiff
path: root/lib/Analysis/CFGPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-22 16:30:58 +0000
committerChris Lattner <sabre@nondot.org>2003-10-22 16:30:58 +0000
commitd073ea00535614323aafd36e3e71582311089700 (patch)
tree9f908325496e14daf745ee6158a50f7f7b696e8c /lib/Analysis/CFGPrinter.cpp
parenta75b3ef9a8b1c88a362eed65f7527d0dc1e54b54 (diff)
Make sure to print labels on nodes without names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9376 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFGPrinter.cpp')
-rw-r--r--lib/Analysis/CFGPrinter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index 4d6819d4fa4..ac93d4c1ca0 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -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());