diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-10-21 19:53:10 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-21 19:53:10 +0000 |
| commit | 1ca20df4371a0ba0842c0fa0ad6ce71871ea54c4 (patch) | |
| tree | 10f4d4227ce9c63bbe7202424a26b53ab49fbd55 | |
| parent | c7d4f28254cea43ef44d204db10fe6346b12e21b (diff) | |
| download | bcm5719-llvm-1ca20df4371a0ba0842c0fa0ad6ce71871ea54c4.tar.gz bcm5719-llvm-1ca20df4371a0ba0842c0fa0ad6ce71871ea54c4.zip | |
Clear raw_fd_ostream error string on success and explain behavior in
documentation.
Add C++ header marker.
llvm-svn: 57923
| -rw-r--r-- | llvm/include/llvm/Support/raw_ostream.h | 9 | ||||
| -rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h index 5ab0988d3ee..af53477cea3 100644 --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -1,4 +1,4 @@ -//===--- raw_ostream.h - Raw output stream --------------------------------===// +//===--- raw_ostream.h - Raw output stream ----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -152,9 +152,10 @@ class raw_fd_ostream : public raw_ostream { int FD; bool ShouldClose; public: - /// raw_fd_ostream - Open the specified file for writing. If an error occurs, - /// information about the error is put into ErrorInfo, and the stream should - /// be immediately destroyed. + /// raw_fd_ostream - Open the specified file for writing. If an + /// error occurs, information about the error is put into ErrorInfo, + /// and the stream should be immediately destroyed; the string will + /// be empty if no error occurred. raw_fd_ostream(const char *Filename, std::string &ErrorInfo); /// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 008f85603ee..f3a53a50617 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -196,10 +196,13 @@ void format_object_base::home() { // raw_fd_ostream //===----------------------------------------------------------------------===// -/// raw_fd_ostream - Open the specified file for writing. If an error occurs, -/// information about the error is put into ErrorInfo, and the stream should -/// be immediately destroyed. +/// raw_fd_ostream - Open the specified file for writing. If an error +/// occurs, information about the error is put into ErrorInfo, and the +/// stream should be immediately destroyed; the string will be empty +/// if no error occurred. raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo) { + ErrorInfo.clear(); + // Handle "-" as stdout. if (Filename[0] == '-' && Filename[1] == 0) { FD = STDOUT_FILENO; |

