From 524dea4d4ca6ecafa18e1e011934a2129c770f4f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Aug 2009 15:58:55 +0000 Subject: Move SetBufferSize and SetUnbuffered out of line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78909 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/raw_ostream.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/Support/raw_ostream.cpp') 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) -- cgit v1.1