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

Daniel Dunbar daniel at zuster.org
Tue Aug 18 13:07:36 PDT 2009


Author: ddunbar
Date: Tue Aug 18 15:07:36 2009
New Revision: 79361

URL: http://llvm.org/viewvc/llvm-project?rev=79361&view=rev
Log:
Revert r78924, disabling buffering defeats all the fast paths in raw_ostream.

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=79361&r1=79360&r2=79361&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Tue Aug 18 15:07:36 2009
@@ -376,7 +376,8 @@
   virtual uint64_t current_pos();
 
 public:
-  raw_os_ostream(std::ostream &O) : raw_ostream(true), OS(O) {}
+  raw_os_ostream(std::ostream &O) : OS(O) {}
+  ~raw_os_ostream();
 
   /// tell - Return the current offset with the stream.
   uint64_t tell();
@@ -394,7 +395,8 @@
   /// counting the bytes currently in the buffer.
   virtual uint64_t current_pos() { return OS.size(); }
 public:
-  explicit raw_string_ostream(std::string &O) : raw_ostream(true), OS(O) {}
+  explicit raw_string_ostream(std::string &O) : OS(O) {}
+  ~raw_string_ostream();
 
   /// tell - Return the current offset with the stream.
   uint64_t tell() { return OS.size() + GetNumBytesInBuffer(); }
@@ -420,8 +422,8 @@
   /// counting the bytes currently in the buffer.
   virtual uint64_t current_pos();
 public:
-  explicit raw_svector_ostream(SmallVectorImpl<char> &O)
-    : raw_ostream(true), OS(O) {}
+  explicit raw_svector_ostream(SmallVectorImpl<char> &O) : OS(O) {}
+  ~raw_svector_ostream();
 
   /// tell - Return the current offset with the stream.
   uint64_t tell();

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

==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 15:07:36 2009
@@ -456,6 +456,10 @@
 //  raw_os_ostream
 //===----------------------------------------------------------------------===//
 
+raw_os_ostream::~raw_os_ostream() {
+  flush();
+}
+
 void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
   OS.write(Ptr, Size);
 }
@@ -470,6 +474,10 @@
 //  raw_string_ostream
 //===----------------------------------------------------------------------===//
 
+raw_string_ostream::~raw_string_ostream() {
+  flush();
+}
+
 void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
   OS.append(Ptr, Size);
 }
@@ -478,6 +486,10 @@
 //  raw_svector_ostream
 //===----------------------------------------------------------------------===//
 
+raw_svector_ostream::~raw_svector_ostream() {
+  flush();
+}
+
 void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
   OS.append(Ptr, Ptr + Size);
 }





More information about the llvm-commits mailing list