[llvm-commits] [llvm] r79362 - /llvm/trunk/lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Tue Aug 18 13:09:59 PDT 2009
Author: djg
Date: Tue Aug 18 15:09:59 2009
New Revision: 79362
URL: http://llvm.org/viewvc/llvm-project?rev=79362&view=rev
Log:
Fix a bug in raw_ostream::write(char) introduced by the change to
allow underlying stream classes to decline buffering. After
calling SetBuffered(), re-check whether the stream is Unbuffered
in order to handle the case where the underlying stream has
declined buffering.
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=79362&r1=79361&r2=79362&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 18 15:09:59 2009
@@ -187,10 +187,17 @@
return *this;
}
- if (!OutBufStart)
- SetBuffered();
- else
+ if (OutBufStart)
flush_nonempty();
+ else {
+ SetBuffered();
+ // It's possible for the underlying stream to decline
+ // buffering, so check this condition again.
+ if (Unbuffered) {
+ write_impl(reinterpret_cast<char*>(&C), 1);
+ return *this;
+ }
+ }
}
*OutBufCur++ = C;
More information about the llvm-commits
mailing list