summaryrefslogtreecommitdiff
path: root/tools/opt/GraphPrinters.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 07:31:22 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 07:31:22 +0000
commit2e35bec78a3279ceb330bec3d401ba6e8da8480c (patch)
tree058a5cd31a5880eae4d74085b779cfebaf3e4ef4 /tools/opt/GraphPrinters.cpp
parent103289e9383ad1eb66caf28c9b166aebce963a35 (diff)
downloadllvm-2e35bec78a3279ceb330bec3d401ba6e8da8480c.tar.gz
llvm-2e35bec78a3279ceb330bec3d401ba6e8da8480c.tar.bz2
llvm-2e35bec78a3279ceb330bec3d401ba6e8da8480c.tar.xz
use raw_fd_ostream instead of fstream with graphwriter,
flush the right stream in opt.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/GraphPrinters.cpp')
-rw-r--r--tools/opt/GraphPrinters.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp
index 6bd0a6e9f7..c38469cc12 100644
--- a/tools/opt/GraphPrinters.cpp
+++ b/tools/opt/GraphPrinters.cpp
@@ -28,9 +28,10 @@ static void WriteGraphToFile(std::ostream &O, const std::string &GraphName,
const GraphType &GT) {
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!";