[llvm-commits] [llvm] r57923 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp

Daniel Dunbar daniel at zuster.org
Tue Oct 21 12:53:11 PDT 2008


Author: ddunbar
Date: Tue Oct 21 14:53:10 2008
New Revision: 57923

URL: http://llvm.org/viewvc/llvm-project?rev=57923&view=rev
Log:
Clear raw_fd_ostream error string on success and explain behavior in
documentation.

Add C++ header marker.

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

Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=57923&r1=57922&r2=57923&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Oct 21 14:53:10 2008
@@ -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 @@
   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

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=57923&r1=57922&r2=57923&view=diff

==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Oct 21 14:53:10 2008
@@ -196,10 +196,13 @@
 //  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;





More information about the llvm-commits mailing list