[llvm-commits] [llvm] r78909 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Thu Aug 13 08:58:55 PDT 2009
Author: djg
Date: Thu Aug 13 10:58:55 2009
New Revision: 78909
URL: http://llvm.org/viewvc/llvm-project?rev=78909&view=rev
Log:
Move SetBufferSize and SetUnbuffered out of line.
Modified:
llvm/trunk/include/llvm/Support/raw_ostream.h
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=78909&r1=78908&r2=78909&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Thu Aug 13 10:58:55 2009
@@ -94,17 +94,7 @@
/// 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 @@
/// 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;
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=78909&r1=78908&r2=78909&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Thu Aug 13 10:58:55 2009
@@ -63,6 +63,26 @@
// 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)
More information about the llvm-commits
mailing list