[llvm-commits] [llvm] r78836 - in /llvm/trunk/include/llvm/Support: FormattedStream.h raw_ostream.h
Dan Gohman
gohman at apple.com
Wed Aug 12 13:52:45 PDT 2009
Author: djg
Date: Wed Aug 12 15:52:45 2009
New Revision: 78836
URL: http://llvm.org/viewvc/llvm-project?rev=78836&view=rev
Log:
Add a GetBufferSize() member to raw_ostream and use it to
simplify some formatted_raw_ostream code.
Modified:
llvm/trunk/include/llvm/Support/FormattedStream.h
llvm/trunk/include/llvm/Support/raw_ostream.h
Modified: llvm/trunk/include/llvm/Support/FormattedStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FormattedStream.h?rev=78836&r1=78835&r2=78836&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FormattedStream.h (original)
+++ llvm/trunk/include/llvm/Support/FormattedStream.h Wed Aug 12 15:52:45 2009
@@ -116,8 +116,7 @@
// own buffering, and it doesn't need or want TheStream to do another
// layer of buffering underneath. Resize the buffer to what TheStream
// had been using, and tell TheStream not to do its own buffering.
- TheStream->flush();
- if (size_t BufferSize = TheStream->GetNumBytesInBuffer())
+ if (size_t BufferSize = TheStream->GetBufferSize())
SetBufferSize(BufferSize);
TheStream->SetUnbuffered();
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=78836&r1=78835&r2=78836&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Wed Aug 12 15:52:45 2009
@@ -106,6 +106,10 @@
Unbuffered = false;
}
+ size_t GetBufferSize() const {
+ return OutBufEnd - OutBufStart;
+ }
+
/// SetUnbuffered - Set the streams buffering status. When
/// unbuffered the stream will flush after every write. This routine
/// will also flush the buffer immediately when the stream is being
More information about the llvm-commits
mailing list