Displaying 11 results from an estimated 11 matches for "releasestream".
2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Friday 18 December 2009 13:56, David Greene wrote:
> 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 (De...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
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)
> > >...
2009 Dec 18
4
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...rSize is not zero? This stream won't
> work well and doesn't make sense with a buffer of zero.
Sure it does. In fact it's crucial for making dbgs() work like errs() in
the default case.
> > + void setStream(raw_ostream &Stream, bool Delete = false) {
> > + releaseStream();
> > +
> > + TheStream = &Stream;
> > + DeleteStream = Delete;
> > +
> > + if (BufferSize > 0) {
>
> The only time where it makes sense for BufferSize to be zero here is if the
> circular stream was default constructed. In this case, i...
2009 Dec 17
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...e);
+ }
+ explicit circular_raw_ostream()
+ : raw_ostream(/*unbuffered*/true),
+ TheStream(0),
+ DeleteStream(PRESERVE_STREAM),
+ BufferArray(0) {
+ Cur = BufferArray;
+ }
+
+ ~circular_raw_ostream() {
+ flush();
+ dumpLog();
+ releaseStream();
+ delete[] BufferArray;
+ }
+
+ void setStream(raw_ostream &Stream, bool Delete = false) {
+ releaseStream();
+
+ TheStream = &Stream;
+ DeleteStream = Delete;
+
+ if (BufferSize > 0) {
+ // This circular_raw_ostream will do its own buffering and...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Friday 18 December 2009 17:22, David Greene wrote:
> On Friday 18 December 2009 13:56, David Greene wrote:
> > 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;
> > >...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...(BufferSize > 0)
> + BufferArray = new char[BufferSize];
How about just asserting that BufferSize is not zero? This stream won't work well and doesn't make sense with a buffer of zero.
>
> + void setStream(raw_ostream &Stream, bool Delete = false) {
> + releaseStream();
> +
> + TheStream = &Stream;
> + DeleteStream = Delete;
> +
> + if (BufferSize > 0) {
The only time where it makes sense for BufferSize to be zero here is if the circular stream was default constructed. In this case, it seems reasonable to allocate a buffer...
2009 Dec 21
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...+ explicit circular_raw_ostream()
+ : raw_ostream(/*unbuffered*/true),
+ TheStream(0),
+ OwnsStream(REFERENCE_ONLY),
+ BufferArray(0) {
+ Cur = BufferArray;
+ }
+
+ ~circular_raw_ostream() {
+ flush();
+ flushBufferWithBanner();
+ releaseStream();
+ delete[] BufferArray;
+ }
+
+ /// setStream - Tell the circular_raw_ostream to output a
+ /// different stream. "Owns" tells circular_raw_ostream whether
+ /// it should take responsibility for managing the underlying
+ /// stream.
+ ///
+ void setStream(ra...
2009 Dec 16
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Wednesday 16 December 2009 13:19, Chris Lattner wrote:
> + int BufferSize;
> + std::vector<char> BufferArray;
> + bool DelayOutput;
> + std::vector<char>::iterator Cur;
>
> Please doxygenify these.
Ok.
> Instead of using a std::vector for BufferArray, please just new[] an array
> since it is fixed size.
Ok.
> Why is BufferSize needed with
2009 Dec 19
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Friday 18 December 2009 19:47, Chris Lattner wrote:
> On Dec 18, 2009, at 3:46 PM, David Greene wrote:
> > + /// circular_raw_ostream - A raw_ostream that saves its output in a
> > + /// circular buffer.
>
> A better description would be "which *can* save its data to a circular
> buffer, or can pass it through directly to an underlying stream if
> specified
2009 Dec 16
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Dec 16, 2009, at 8:12 AM, David Greene wrote:
>>>
>>> What, specifically, do you want reviewed before I start checking in?
>>> I'll be happy to prepare a patch that shows just that.
>>
>> I want a patch that does one thing (e.g. implements dbgs(),
>
> Ok, let's start with that. Here's the patch to add the circular raw_ostream.
This
2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...e);
+ }
+ explicit circular_raw_ostream()
+ : raw_ostream(/*unbuffered*/true),
+ TheStream(0),
+ DeleteStream(PRESERVE_STREAM),
+ BufferArray(0) {
+ Cur = BufferArray;
+ }
+
+ ~circular_raw_ostream() {
+ flush();
+ dumpLog();
+ releaseStream();
+ delete[] BufferArray;
+ }
+
+ void setStream(raw_ostream &Stream, bool Delete = false) {
+ releaseStream();
+
+ TheStream = &Stream;
+ DeleteStream = Delete;
+
+ if (BufferSize > 0) {
+ // This circular_raw_ostream will do its own buffering and...