Move SetBufferSize and SetUnbuffered out of line.
authorDan Gohman <gohman@apple.com>
Thu, 13 Aug 2009 15:58:55 +0000 (15:58 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 13 Aug 2009 15:58:55 +0000 (15:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78909 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 58de3e81867c8ee2b51b72b876fce14dddd4a84b..82520ce19117980f2bbad15b5f9932e3f076bc8e 100644 (file)
@@ -94,17 +94,7 @@ public:
 
   /// SetBufferSize - Set the internal buffer size to the specified amount
   /// instead of the default.
-  void SetBufferSize(size_t Size=4096) {
-    assert(Size >= 64 &&
-           "Buffer size must be somewhat large for invariants to hold");
-    flush();
-
-    delete [] OutBufStart;
-    OutBufStart = new char[Size];
-    OutBufEnd = OutBufStart+Size;
-    OutBufCur = OutBufStart;
-    Unbuffered = false;
-  }
+  void SetBufferSize(size_t Size=4096);
 
   size_t GetBufferSize() const {
     return OutBufEnd - OutBufStart;
@@ -114,13 +104,7 @@ public:
   /// unbuffered the stream will flush after every write. This routine
   /// will also flush the buffer immediately when the stream is being
   /// set to unbuffered.
-  void SetUnbuffered() {
-    flush();
-    
-    delete [] OutBufStart;
-    OutBufStart = OutBufEnd = OutBufCur = 0;
-    Unbuffered = true;
-  }
+  void SetUnbuffered();
 
   size_t GetNumBytesInBuffer() const {
     return OutBufCur - OutBufStart;
index 11a11bd930a73a1bb313dc7373ea569c1d5c54ae..2a2458d61a394a593e8b3967894b28ed0b771b1a 100644 (file)
@@ -63,6 +63,26 @@ raw_ostream::~raw_ostream() {
 // An out of line virtual method to provide a home for the class vtable.
 void raw_ostream::handle() {}
 
+void raw_ostream::SetBufferSize(size_t Size) {
+  assert(Size >= 64 &&
+         "Buffer size must be somewhat large for invariants to hold");
+  flush();
+
+  delete [] OutBufStart;
+  OutBufStart = new char[Size];
+  OutBufEnd = OutBufStart+Size;
+  OutBufCur = OutBufStart;
+  Unbuffered = false;
+}
+
+void raw_ostream::SetUnbuffered() {
+  flush();
+
+  delete [] OutBufStart;
+  OutBufStart = OutBufEnd = OutBufCur = 0;
+  Unbuffered = true;
+}
+
 raw_ostream &raw_ostream::operator<<(unsigned long N) {
   // Zero is a special case.
   if (N == 0)