Move SetBufferSize and SetUnbuffered out of line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78909 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2009-08-13 15:58:55 +00:00
parent 6d3d9c3fc3
commit 524dea4d4c
2 changed files with 22 additions and 18 deletions

View 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;

View 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)