diff options
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
| -rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index a91fe9b5364..0c1843c457c 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -187,10 +187,17 @@ raw_ostream &raw_ostream::write(unsigned char C) {        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; | 

