diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-13 15:58:55 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-13 15:58:55 +0000 |
commit | 524dea4d4ca6ecafa18e1e011934a2129c770f4f (patch) | |
tree | c7f2f92d3ad58b7d8291442adf72faa0d0c7e1e7 | |
parent | 6d3d9c3fc3b98e9c12ca38acaffa77cf02deffe6 (diff) | |
download | external_llvm-524dea4d4ca6ecafa18e1e011934a2129c770f4f.zip external_llvm-524dea4d4ca6ecafa18e1e011934a2129c770f4f.tar.gz external_llvm-524dea4d4ca6ecafa18e1e011934a2129c770f4f.tar.bz2 |
Move SetBufferSize and SetUnbuffered out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78909 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Support/raw_ostream.h | 20 | ||||
-rw-r--r-- | lib/Support/raw_ostream.cpp | 20 |
2 files changed, 22 insertions, 18 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 58de3e8..82520ce 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -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; diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 11a11bd..2a2458d 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -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) |