[llvm-commits] [llvm] r111822 - /llvm/trunk/include/llvm/Support/FormattedStream.h

Dan Gohman gohman at apple.com
Mon Aug 23 11:43:24 PDT 2010


Author: djg
Date: Mon Aug 23 13:43:24 2010
New Revision: 111822

URL: http://llvm.org/viewvc/llvm-project?rev=111822&view=rev
Log:
formatted_tool_output_file::close needs to flush its buffer before
closing the underlying stream.

Modified:
    llvm/trunk/include/llvm/Support/FormattedStream.h

Modified: llvm/trunk/include/llvm/Support/FormattedStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=111822&r1=111821&r2=111822&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FormattedStream.h (original)
+++ llvm/trunk/include/llvm/Support/FormattedStream.h Mon Aug 23 13:43:24 2010
@@ -164,7 +164,12 @@
     void keep()            { return get_tool_output_file().keep(); }
     bool has_error() const { return get_tool_output_file().has_error(); }
     void clear_error()     { return get_tool_output_file().clear_error(); }
-    void close()           { return get_tool_output_file().close(); }
+    void close() {
+      // The inner stream is unbuffered; flush the outer stream's buffer.
+      flush();
+      // The inner stream can close its file descriptor now.
+      return get_tool_output_file().close();
+    }
   };
 
 /// fouts() - This returns a reference to a formatted_raw_ostream for





More information about the llvm-commits mailing list