diff options
| author | Dan Gohman <gohman@apple.com> | 2010-08-20 16:44:56 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-08-20 16:44:56 +0000 |
| commit | 4b3d30bb7ce8c4f1c6f42319bc4d10accf66ac9b (patch) | |
| tree | 01120e220a61b54d440b3c1ff4a06784cb95cf0f | |
| parent | 77684e143c5a88d1f834b5311cb98425b423695e (diff) | |
| download | external_llvm-4b3d30bb7ce8c4f1c6f42319bc4d10accf66ac9b.zip external_llvm-4b3d30bb7ce8c4f1c6f42319bc4d10accf66ac9b.tar.gz external_llvm-4b3d30bb7ce8c4f1c6f42319bc4d10accf66ac9b.tar.bz2 | |
Make outs() close its file when its stream is destructed, so that
pending output errors are detected.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111643 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/Support/raw_ostream.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 9915b0c..371dc8b 100644 --- a/lib/Support/raw_ostream.cpp +++ b/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; } |
