search for: circular_raw_ostream

Displaying 20 results from an estimated 43 matches for "circular_raw_ostream".

2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...t counting the bytes currently in the buffer. + virtual uint64_t current_pos() { + // This has the same effect as calling TheStream.current_pos(), + // but that interface is private. + return TheStream->tell() - TheStream->GetNumBytesInBuffer(); + } + + public: + /// circular_raw_ostream - Open the specified file for + /// writing. + /// + /// As a side effect, if BuffSize is nonzero, the given Stream is + /// set to be Unbuffered. This is because circular_raw_ostream + /// does its own buffering, so it doesn't want another layer of + /// buffering to be hap...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...ng the buffer size of the held stream when we release it. This code > > is identical to the code in formatted_raw_ostream. > > Here's the updated patch. Well, that didn't go through right. Here it is again. -Dave Index: include/llvm/Support/circular_raw_ostream.h =================================================================== --- include/llvm/Support/circular_raw_ostream.h (revision 0) +++ include/llvm/Support/circular_raw_ostream.h (revision 0) @@ -0,0 +1,149 @@ +//===-- llvm/Support/circular_raw_ostream.h - Buffered streams --*- C++ -*-===// +// +/...
2009 Dec 21
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...s(). I anticipate that while I'll change most uses of errs() to dbgs(), > we probably don't want to change all of them. > > I agree the naming here is poor. I'll fix that. Here's the next iteration. -Dave Index: include/llvm/Support/circular_raw_ostream.h =================================================================== --- include/llvm/Support/circular_raw_ostream.h (revision 0) +++ include/llvm/Support/circular_raw_ostream.h (revision 0) @@ -0,0 +1,166 @@ +//===-- llvm/Support/circular_raw_ostream.h - Buffered streams --*- C++ -*-===// +// +/...
2009 Dec 18
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
On Friday 18 December 2009 17:27, David Greene wrote: > > Here's the updated patch. > > Well, that didn't go through right. Here it is again. Argh! Stupid bug fixed. :) Index: include/llvm/Support/circular_raw_ostream.h =================================================================== --- include/llvm/Support/circular_raw_ostream.h (revision 0) +++ include/llvm/Support/circular_raw_ostream.h (revision 0) @@ -0,0 +1,149 @@ +//===-- llvm/Support/circular_raw_ostream.h - Buffered streams --*- C++ -*-===// +// +/...
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 with a buffer of zero." Make sense. > W...
2009 Dec 17
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...id Greene wrote: > > Please make BufferSize an 'unsigned' and default it to 8192. Please use > > PRESERVE_STREAM instead of 'false'. Here's an updated version of the circular buffer. Ok to check in? -Dave Index: include/llvm/Support/circular_raw_ostream.h =================================================================== --- include/llvm/Support/circular_raw_ostream.h (revision 0) +++ include/llvm/Support/circular_raw_ostream.h (revision 0) @@ -0,0 +1,150 @@ +//===-- llvm/Support/circular_raw_ostream.h - Buffered streams --*- C++ -*-===// +// +/...
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 16
2
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...std::vector for BufferArray, please just new[] an array since it is fixed size. Why is BufferSize needed with the vector? Isn't it always the size of BufferArray? Also, why is it signed? What does DelayOutput do? Even reading the code, I don't really understand what it is doing. + circular_raw_ostream(raw_ostream &Stream, int BufferSize = -1, + bool Delete = false) + : raw_ostream(/*unbuffered*/true), TheStream(0), DeleteStream(false), + BufferArray(BufferSize < 0 ? 8192 : BufferSize), Please make BufferSize an 'unsigned' and default it...
2009 Dec 19
3
[LLVMdev] [PATCH] Implement dbgs()
...bout "Buffer the last N characters of debug output until program > termination". This should probably also be cl::Hidden. Ok. > > +// Signal handlers - dump debug output on termination. > > +static void debug_user_sig_handler(void *Cookie) > > +{ > > + llvm::circular_raw_ostream *logout = > > + dynamic_cast<llvm::circular_raw_ostream *>(&llvm::dbgs()); > > Please do not use dynamic_cast, we're trying to eliminate the last > RTTI use in the compiler. Do you want me to use dyn_cast? That means I'll have to add some more stuff to raw_ostr...
2009 Dec 18
2
[LLVMdev] [PATCH] Implement dbgs()
...ug.cpp =================================================================== --- lib/Support/Debug.cpp (revision 91557) +++ lib/Support/Debug.cpp (working copy) @@ -25,6 +25,9 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/circular_raw_ostream.h" +#include "llvm/System/Signals.h" + using namespace llvm; // All Debug.h functionality is a no-op in NDEBUG mode. @@ -37,6 +40,15 @@ Debug("debug", cl::desc("Enable debug output"), cl::Hidden, cl::location(DebugFlag)); +// -debug-buffer-size - Thi...
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 19
0
[LLVMdev] [PATCH] Implement dbgs()
...============================== > --- include/llvm/Support/Debug.h (revision 91557) Ok. > +++ lib/Support/Debug.cpp (working copy) > @@ -25,6 +25,9 @@ > > #include "llvm/Support/CommandLine.h" > #include "llvm/Support/Debug.h" > +#include "llvm/Support/circular_raw_ostream.h" > +#include "llvm/System/Signals.h" > + > using namespace llvm; > > // All Debug.h functionality is a no-op in NDEBUG mode. > @@ -37,6 +40,15 @@ > Debug("debug", cl::desc("Enable debug output"), cl::Hidden, > cl::location(DebugFlag...
2009 Dec 19
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
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 with a buffer of zero." When it is buffering, what causes it to...
2009 Dec 18
4
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...ounting the bytes currently in the buffer. > > + virtual uint64_t current_pos() { > > I didn't notice this earlier, but is there any reason for current_pos to be > non-const in raw_ostream? Probably not. I'm going to let someone else fix that, though. > > + /// circular_raw_ostream - Open the specified file for > > + /// writing. If an error occurs, information about the error is > > + /// put into ErrorInfo, and the stream should be immediately > > + /// destroyed; the string will be empty if no error occurred. > > This comment is out of date...
2009 Dec 19
0
[LLVMdev] [PATCH] Implement dbgs()
On Dec 18, 2009, at 6:36 PM, David Greene wrote: >>> +// Signal handlers - dump debug output on termination. >>> +static void debug_user_sig_handler(void *Cookie) >>> +{ >>> + llvm::circular_raw_ostream *logout = >>> + dynamic_cast<llvm::circular_raw_ostream *>(&llvm::dbgs()); >> >> Please do not use dynamic_cast, we're trying to eliminate the last >> RTTI use in the compiler. > > Do you want me to use dyn_cast? That means I'll have to add s...
2009 Dec 21
2
[LLVMdev] [PATCH] Implement dbgs()
On Saturday 19 December 2009 00:16, Chris Lattner wrote: > > Or I think I can just assume (Yikes!) that if the signal handler is > > invoked it will really be a circular_raw_ostream since the handler > > should (!) only be set up in debug mode. > > > > That scares me a bit, though. > > Why don't you just check #ifndef NDEBUG like the code that sets it up? Next iteration. -Dave Index: include/llvm/Support/Debug.h ===...
2009 Dec 18
0
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...; + /// current_pos - Return the current position within the stream, > + /// not counting the bytes currently in the buffer. > + virtual uint64_t current_pos() { I didn't notice this earlier, but is there any reason for current_pos to be non-const in raw_ostream? > + /// circular_raw_ostream - Open the specified file for > + /// writing. If an error occurs, information about the error is > + /// put into ErrorInfo, and the stream should be immediately > + /// destroyed; the string will be empty if no error occurred. This comment is out of date, there is no ErrorInfo....
2009 Dec 21
2
[LLVMdev] [PATCH] Implement dbgs()
On Monday 21 December 2009 10:14, Török Edwin wrote: > On 2009-12-21 18:06, David Greene wrote: > > On Saturday 19 December 2009 00:16, Chris Lattner wrote: > >>> Or I think I can just assume (Yikes!) that if the signal handler is > >>> invoked it will really be a circular_raw_ostream since the handler > >>> should (!) only be set up in debug mode. > >>> > >>> That scares me a bit, though. > >> > >> Why don't you just check #ifndef NDEBUG like the code that sets it up? > > > > Next iteration. > > Will th...
2009 Dec 21
0
[LLVMdev] [PATCH] Implement dbgs()
On 2009-12-21 18:06, David Greene wrote: > On Saturday 19 December 2009 00:16, Chris Lattner wrote: > > >>> Or I think I can just assume (Yikes!) that if the signal handler is >>> invoked it will really be a circular_raw_ostream since the handler >>> should (!) only be set up in debug mode. >>> >>> That scares me a bit, though. >>> >> Why don't you just check #ifndef NDEBUG like the code that sets it up? >> > > Next iteration. > Will this setup a...
2009 Dec 21
3
[LLVMdev] [PATCH] Circular Buffered Debug Stream
...attachments, it makes them easier to review. >> Now that I understand the model :) I don't see why you need to fiddle >> with the underlying buffering of TheStream. In the dbgs() use case, >> the underlying stream will be errs() which is already unbuffered. > > Might circular_raw_ostream be used with other streams at some point? In that case, setting the underlying stream to unbuffered seems even more dangerous. The client who sets up the buffers has both the power and the knowledge to set the streams up correctly when the streams are created. > + /// flushBuffer - Dump...