diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-22 16:22:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-22 16:22:42 +0000 |
commit | 9d63afdea554336e27f3cbc38b9e1f071e280662 (patch) | |
tree | 2dbd914a146d3cdd1d032c4f7faa582172ba41d5 /llvm/lib/Analysis/CFGPrinter.cpp | |
parent | a93d11bc1d3ddc6b922867aeef066c464fc59618 (diff) | |
download | bcm5719-llvm-9d63afdea554336e27f3cbc38b9e1f071e280662.tar.gz bcm5719-llvm-9d63afdea554336e27f3cbc38b9e1f071e280662.zip |
If the basic block has no name, make sure to print the % number of it
llvm-svn: 9375
Diffstat (limited to 'llvm/lib/Analysis/CFGPrinter.cpp')
-rw-r--r-- | llvm/lib/Analysis/CFGPrinter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp index bb2912b060e..4d6819d4fa4 100644 --- a/llvm/lib/Analysis/CFGPrinter.cpp +++ b/llvm/lib/Analysis/CFGPrinter.cpp @@ -21,6 +21,7 @@ #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/iTerminators.h" +#include "llvm/Assembly/Writer.h" #include "llvm/Support/CFG.h" #include <sstream> #include <fstream> @@ -39,9 +40,14 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { static std::string getNodeLabel(const BasicBlock *Node, const Function *Graph) { - if (CFGOnly) return Node->getName() + ":"; + if (CFGOnly && !Node->getName().empty()) return Node->getName() + ":"; std::ostringstream Out; + if (CFGOnly) { + WriteAsOperand(Out, Node, false, true); + return Out.str(); + } + Out << *Node; std::string OutStr = Out.str(); if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); |