[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Nov 19 19:46:03 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGPrinter.cpp updated: 1.27 -> 1.28
---
Log message:
more progress towards bug 291: http://llvm.cs.uiuc.edu/PR291 being finished. Patch by Owen Anderson,
HAVE_GV case fixed up by me.
---
Diffs of the changes: (+17 -12)
SelectionDAGPrinter.cpp | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.27 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.28
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.27 Sat Nov 19 01:44:09 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Sat Nov 19 21:45:52 2005
@@ -109,11 +109,11 @@
void SelectionDAG::viewGraph() {
// This code is only for debugging!
#ifndef NDEBUG
- std::string TempDir = sys::Path::GetTemporaryDirectory().toString();
- std::string Filename = TempDir + "dag." +
- getMachineFunction().getFunction()->getName() + ".dot";
- std::cerr << "Writing '" << Filename << "'... ";
- std::ofstream F(Filename.c_str());
+ sys::Path TempDir = sys::Path::GetTemporaryDirectory();
+ sys::Path Filename = TempDir;
+ Filename.appendComponent("dag." + getMachineFunction().getFunction()->getName() + ".dot");
+ std::cerr << "Writing '" << Filename.toString() << "'... ";
+ std::ofstream F(Filename.toString().c_str());
if (!F) {
std::cerr << " error opening file for writing!\n";
@@ -126,24 +126,28 @@
#ifdef HAVE_GRAPHVIZ
std::cerr << "Running 'Graphviz' program... " << std::flush;
- if (system((LLVM_PATH_GRAPHVIZ " " + Filename).c_str())) {
+ if (system((LLVM_PATH_GRAPHVIZ " " + Filename.toString()).c_str())) {
std::cerr << "Error viewing graph: 'Graphviz' not in path?\n";
} else {
- system(("rm " + Filename).c_str());
+ Filename.eraseFromDisk();
return;
}
#endif // HAVE_GRAPHVIZ
#ifdef HAVE_GV
std::cerr << "Running 'dot' program... " << std::flush;
- if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
- + " > " + TempDir +"dag.tempgraph.ps").c_str())) {
+ sys::Path PSFilename = TempDir;
+ PSFilename.appendComponent("dag.tempgraph.ps");
+ if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename.toString()
+ + " > " + PSFilename.toString()).c_str())) {
std::cerr << "Error viewing graph: 'dot' not in path?\n";
} else {
std::cerr << "\n";
- system(LLVM_PATH_GV " " + TempDir + "dag.tempgraph.ps");
+ system((LLVM_PATH_GV " " + PSFilename.toString()).c_str());
+ system((LLVM_PATH_GV " "+TempDir.toString()+ "dag.tempgraph.ps").c_str());
}
- system(("rm " + Filename + " "+ TempDir + "dag.tempgraph.ps").c_str());
+ Filename.eraseFromDisk();
+ PSFilename.eraseFromDisk();
return;
#endif // HAVE_GV
#endif // NDEBUG
@@ -151,6 +155,7 @@
<< "systems with Graphviz or gv!\n";
#ifndef NDEBUG
- system(("rm " + Filename).c_str());
+ Filename.eraseFromDisk();
+ TempDir.eraseFromDisk(true);
#endif
}
More information about the llvm-commits
mailing list