[llvm-commits] [llvm] r79837 - in /llvm/trunk/tools/opt: GraphPrinters.cpp opt.cpp
Chris Lattner
sabre at nondot.org
Sun Aug 23 00:31:23 PDT 2009
Author: lattner
Date: Sun Aug 23 02:31:22 2009
New Revision: 79837
URL: http://llvm.org/viewvc/llvm-project?rev=79837&view=rev
Log:
use raw_fd_ostream instead of fstream with graphwriter,
flush the right stream in opt.cpp.
Modified:
llvm/trunk/tools/opt/GraphPrinters.cpp
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/tools/opt/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/GraphPrinters.cpp?rev=79837&r1=79836&r2=79837&view=diff
==============================================================================
--- llvm/trunk/tools/opt/GraphPrinters.cpp (original)
+++ llvm/trunk/tools/opt/GraphPrinters.cpp Sun Aug 23 02:31:22 2009
@@ -28,9 +28,10 @@
const GraphType >) {
std::string Filename = GraphName + ".dot";
O << "Writing '" << Filename << "'...";
- std::ofstream F(Filename.c_str());
+ std::string ErrInfo;
+ raw_fd_ostream F(Filename.c_str(), ErrInfo, raw_fd_ostream::F_Force);
- if (F.good())
+ if (ErrInfo.empty())
WriteGraph(F, GT);
else
O << " error opening file for writing!";
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=79837&r1=79836&r2=79837&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Sun Aug 23 02:31:22 2009
@@ -141,7 +141,7 @@
if (F) {
outs().flush();
getAnalysisID<Pass>(PassToPrint).print(outs(), F->getParent());
- cout << std::flush;
+ outs().flush();
}
}
}
@@ -170,7 +170,7 @@
outs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
outs().flush();
getAnalysisID<Pass>(PassToPrint).print(outs(), &M);
- cout << std::flush;
+ outs().flush();
}
// Get and print pass...
@@ -200,7 +200,7 @@
// Get and print pass...
outs().flush();
getAnalysisID<Pass>(PassToPrint).print(outs(), F.getParent());
- cout << std::flush;
+ outs().flush();
return false;
}
@@ -226,7 +226,7 @@
outs().flush();
getAnalysisID<Pass>(PassToPrint).print(outs(),
L->getHeader()->getParent()->getParent());
- cout << std::flush;
+ outs().flush();
}
// Get and print pass...
return false;
@@ -257,7 +257,7 @@
// Get and print pass...
outs().flush();
getAnalysisID<Pass>(PassToPrint).print(outs(), BB.getParent()->getParent());
- cout << std::flush;
+ outs().flush();
return false;
}
More information about the llvm-commits
mailing list