[llvm-commits] [llvm] r111643 - /llvm/trunk/lib/Support/raw_ostream.cpp

Dan Gohman gohman at apple.com
Fri Aug 20 09:44:56 PDT 2010


Author: djg
Date: Fri Aug 20 11:44:56 2010
New Revision: 111643

URL: http://llvm.org/viewvc/llvm-project?rev=111643&view=rev
Log:
Make outs() close its file when its stream is destructed, so that
pending output errors are detected.

Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=111643&r1=111642&r2=111643&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Fri Aug 20 11:44:56 2010
@@ -540,14 +540,16 @@
 }
 
 //===----------------------------------------------------------------------===//
-//  raw_stdout/err_ostream
+//  outs(), errs(), nulls()
 //===----------------------------------------------------------------------===//
 
 /// outs() - This returns a reference to a raw_ostream for standard output.
 /// Use it like: outs() << "foo" << "bar";
 raw_ostream &llvm::outs() {
   // Set buffer settings to model stdout behavior.
-  static raw_fd_ostream S(STDOUT_FILENO, false);
+  // Delete the file descriptor when the program exists, forcing error
+  // detection. If you don't want this behavior, don't use outs().
+  static raw_fd_ostream S(STDOUT_FILENO, true);
   return S;
 }
 





More information about the llvm-commits mailing list