Make tool_output_file's raw_ostream instance a member variable instead
[oota-llvm.git] / tools / opt / GraphPrinters.cpp
index d689a4a1dae2e41eec13eb312b4eda8a252630ce..9de7d6ac5459c6b80d6d6a5082c29bb003bbae18 100644 (file)
@@ -31,16 +31,16 @@ static void WriteGraphToFile(raw_ostream &O, const std::string &GraphName,
   tool_output_file F(Filename.c_str(), ErrInfo);
 
   if (ErrInfo.empty()) {
-    WriteGraph(F, GT);
-    F.close();
-    if (!F.has_error()) {
+    WriteGraph(F.os(), GT);
+    F.os().close();
+    if (!F.os().has_error()) {
       O << "\n";
       F.keep();
       return;
     }
   }
-  F.clear_error();
   O << "  error opening file for writing!\n";
+  F.os().clear_error();
 }