[llvm-commits] CVS: llvm/lib/Analysis/CFGPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 22 11:23:01 PDT 2003
Changes in directory llvm/lib/Analysis:
CFGPrinter.cpp updated: 1.1 -> 1.2
---
Log message:
If the basic block has no name, make sure to print the % number of it
---
Diffs of the changes: (+7 -1)
Index: llvm/lib/Analysis/CFGPrinter.cpp
diff -u llvm/lib/Analysis/CFGPrinter.cpp:1.1 llvm/lib/Analysis/CFGPrinter.cpp:1.2
--- llvm/lib/Analysis/CFGPrinter.cpp:1.1 Wed Oct 22 11:03:49 2003
+++ llvm/lib/Analysis/CFGPrinter.cpp Wed Oct 22 11:22:42 2003
@@ -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 @@
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());
More information about the llvm-commits
mailing list