1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Move SetBufferSize and SetUnbuffered out of line.

llvm-svn: 78909
This commit is contained in:
Dan Gohman 2009-08-13 15:58:55 +00:00
parent dd797db6bd
commit fb52ff3ba7
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)