[llvm-commits] [llvm] r66827 - /llvm/trunk/include/llvm/Support/raw_ostream.h

Chris Lattner clattner at apple.com
Thu Mar 12 15:50:42 PDT 2009


On Mar 12, 2009, at 3:02 PM, Daniel Dunbar wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=66827&view=rev
> Log:
> raw_ostream: unbuffered streams weren't being immediately flushed on
> single character writes.

Ack, no!  Please don't do this.  The entire point of these is that  
they are supposed to be small and inline.  If you want to do this,  
please use a body like:


     if (OutBufCur >= OutBufEnd)
       return output_char_slow(C);
     *OutBufCur++ = C;
     return *this;
   }

And arrange for the "OutBufCur >= OutBufEnd" condition to always be  
true for the stderr case (by not having a buffer).

-Chris

>
>
> Modified:
>    llvm/trunk/include/llvm/Support/raw_ostream.h
>
> 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=66827&r1=66826&r2=66827&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
> +++ llvm/trunk/include/llvm/Support/raw_ostream.h Thu Mar 12  
> 17:02:44 2009
> @@ -84,6 +84,8 @@
>     if (OutBufCur >= OutBufEnd)
>       flush_impl();
>     *OutBufCur++ = C;
> +    if (Unbuffered)
> +      flush_impl();
>     return *this;
>   }
>
> @@ -91,6 +93,8 @@
>     if (OutBufCur >= OutBufEnd)
>       flush_impl();
>     *OutBufCur++ = C;
> +    if (Unbuffered)
> +      flush_impl();
>     return *this;
>   }
>
> @@ -98,6 +102,8 @@
>     if (OutBufCur >= OutBufEnd)
>       flush_impl();
>     *OutBufCur++ = C;
> +    if (Unbuffered)
> +      flush_impl();
>     return *this;
>   }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list