Revert r78924, disabling buffering defeats all the fast paths in raw_ostream.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 18 Aug 2009 20:07:36 +0000 (20:07 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 18 Aug 2009 20:07:36 +0000 (20:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79361 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/raw_ostream.h
lib/Support/raw_ostream.cpp

index d9110dd31d8a0a3881d230d82b5634d2b2d3aab9..b1b96f231695b6bbf80d7912e7bdb895c36952fa 100644 (file)
@@ -376,7 +376,8 @@ class raw_os_ostream : public raw_ostream {
   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 @@ class raw_string_ostream : public raw_ostream {
   /// 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 @@ class raw_svector_ostream : public raw_ostream {
   /// 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();
index ea9b801f182577b020344058cdf28af84b1d7e37..a91fe9b5364cb4d35b1a71f78ddcf8e8bf8b9395 100644 (file)
@@ -456,6 +456,10 @@ raw_ostream &llvm::nulls() {
 //  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 @@ uint64_t raw_os_ostream::tell() {
 //  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 @@ void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
 //  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);
 }