summaryrefslogtreecommitdiff
path: root/include/llvm/Support/raw_ostream.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-18 22:26:19 +0000
committerDan Gohman <gohman@apple.com>2010-08-18 22:26:19 +0000
commit2499990699899e6da865c919fe63ef6e6c6f4a00 (patch)
tree39b56f319e6178a362ba47c5559e97b7f55ad051 /include/llvm/Support/raw_ostream.h
parent4bb464178447ce1d58f20e0644f35b690e3215bd (diff)
downloadllvm-2499990699899e6da865c919fe63ef6e6c6f4a00.tar.gz
llvm-2499990699899e6da865c919fe63ef6e6c6f4a00.tar.bz2
llvm-2499990699899e6da865c919fe63ef6e6c6f4a00.tar.xz
Make raw_fd_ostream consider itself the owner of STDOUT_FILENO when
constructed with an output filename of "-". In particular, allow the file descriptor to be closed, and close the file descriptor in the destructor if it hasn't been explicitly closed already, to ensure that any write errors are detected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111436 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/raw_ostream.h')
-rw-r--r--include/llvm/Support/raw_ostream.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index bb9a52330d..b7eae0f300 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -353,8 +353,11 @@ public:
/// be immediately destroyed; the string will be empty if no error occurred.
/// This allows optional flags to control how the file will be opened.
///
- /// \param Filename - The file to open. If this is "-" then the
- /// stream will use stdout instead.
+ /// As a special case, if Filename is "-", then the stream will use
+ /// STDOUT_FILENO instead of opening a file. Note that it will still consider
+ /// itself to own the file descriptor. In particular, it will close the
+ /// file descriptor when it is done (this is necessary to detect
+ /// output errors).
raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
unsigned Flags = 0);