summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-20 16:44:56 +0000
committerDan Gohman <gohman@apple.com>2010-08-20 16:44:56 +0000
commite9a469115cc10f0458f575f922e1f4a77236d1ad (patch)
treec5cce236c853ffd9bb389e15afd821a162d776ba /llvm/lib
parent443f2d6426d52b0921564173ff0877cf3782040c (diff)
downloadbcm5719-llvm-e9a469115cc10f0458f575f922e1f4a77236d1ad.tar.gz
bcm5719-llvm-e9a469115cc10f0458f575f922e1f4a77236d1ad.zip
Make outs() close its file when its stream is destructed, so that
pending output errors are detected. llvm-svn: 111643
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 9915b0c8fd2..371dc8b2556 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -540,14 +540,16 @@ bool raw_fd_ostream::is_displayed() const {
}
//===----------------------------------------------------------------------===//
-// 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;
}
OpenPOWER on IntegriCloud