llvm.org GIT mirror llvm / f3e4884
Add a GetBufferSize() member to raw_ostream and use it to simplify some formatted_raw_ostream code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78836 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
2 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
115115 // own buffering, and it doesn't need or want TheStream to do another
116116 // layer of buffering underneath. Resize the buffer to what TheStream
117117 // had been using, and tell TheStream not to do its own buffering.
118 TheStream->flush();
119 if (size_t BufferSize = TheStream->GetNumBytesInBuffer())
118 if (size_t BufferSize = TheStream->GetBufferSize())
120119 SetBufferSize(BufferSize);
121120 TheStream->SetUnbuffered();
122121
105105 Unbuffered = false;
106106 }
107107
108 size_t GetBufferSize() const {
109 return OutBufEnd - OutBufStart;
110 }
111
108112 /// SetUnbuffered - Set the streams buffering status. When
109113 /// unbuffered the stream will flush after every write. This routine
110114 /// will also flush the buffer immediately when the stream is being