[LLVMdev] [PATCH] Circular Buffered Debug Stream

David Greene dag at cray.com
Fri Dec 18 11:56:28 PST 2009


On Friday 18 December 2009 13:53, David Greene wrote:

> > > +    void releaseStream() {
> > > +      // Delete the stream if needed. Otherwise, transfer the buffer
> > > +      // settings from this raw_ostream back to the underlying stream.
> > > +      if (!TheStream)
> > > +        return;
> > > +      if (DeleteStream)
> > > +        delete TheStream;
> > > +      else if (BufferSize > 0)
> > > +        TheStream->SetBufferSize(BufferSize);
> > > +      else
> > > +        TheStream->SetUnbuffered();
> > Another issue is that this is transfering the circular stream's
> > buffer to the underlying stream.  Would it make more sense and would it
> > be worth it to save the underlying streams buffer size and restore it in
> > releaseStream?
>
> Oh, I think this code is just wrong.  I'll rework it.

No, it's right.  It's not transferring the buffer at all.  It's just setting
the buffer size of the held stream when we release it.  This code is identical
to the code in formatted_raw_ostream.

                                -Dave



More information about the llvm-dev mailing list