class circular_raw_ostream

Declaration

class circular_raw_ostream : public raw_ostream { /* full declaration omitted */ };

Description

circular_raw_ostream - A raw_ostream 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.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:24

Inherits from: raw_ostream

Member Variables

private llvm::raw_ostream* TheStream = nullptr
TheStream - The real stream we output to. We set it to be unbuffered, since we're already doing our own buffering.
private bool OwnsStream
OwnsStream - Are we responsible for managing the underlying stream?
private size_t BufferSize
BufferSize - The size of the buffer in bytes.
private char* BufferArray = nullptr
BufferArray - The actual buffer storage.
private char* Cur
Cur - Pointer to the current output point in BufferArray.
private bool Filled = false
Filled - Indicate whether the buffer has been completely filled. This helps avoid garbage output.
private const char* Banner
Banner - A pointer to a banner to print before dumping the log.
public static const bool TAKE_OWNERSHIP = true
TAKE_OWNERSHIP - Tell this stream that it owns the underlying stream and is responsible for cleanup, memory management issues, etc.
public static const bool REFERENCE_ONLY = false
REFERENCE_ONLY - Tell this stream it should not manage the held stream.

Inherited from raw_ostream:

public static BLACK = Colors::BLACK
public static RED = Colors::RED
public static GREEN = Colors::GREEN
public static YELLOW = Colors::YELLOW
public static BLUE = Colors::BLUE
public static MAGENTA = Colors::MAGENTA
public static CYAN = Colors::CYAN
public static WHITE = Colors::WHITE
public static SAVEDCOLOR = Colors::SAVEDCOLOR
public static RESET = Colors::RESET

Method Overview

Inherited from raw_ostream:

Methods

circular_raw_ostream(llvm::raw_ostream& Stream,
                     const char* Header,
                     size_t BuffSize = 0,
                     bool Owns = REFERENCE_ONLY)

Description

circular_raw_ostream - Construct an optionally circular-buffered stream, handing it an underlying stream to do the "real" output. 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 happening underneath it. "Owns" tells the circular_raw_ostream whether it is responsible for managing the held stream, doing memory management of it, etc.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:107

Parameters

llvm::raw_ostream& Stream
const char* Header
size_t BuffSize = 0
bool Owns = REFERENCE_ONLY

uint64_t current_pos() const

Description

current_pos - Return the current position within the stream, not counting the bytes currently in the buffer.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:87

void flushBuffer()

Description

flushBuffer - Dump the contents of the buffer to Stream.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:72

void flushBufferWithBanner()

Description

flushBufferWithBanner - Force output of the buffer along with a small header.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:142

bool is_displayed() const

Description

This function determines if this stream is connected to a "tty" or "console" window. That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:124

void releaseStream()

Description

releaseStream - Delete the held stream if needed. Otherwise, transfer the buffer settings from this circular_raw_ostream back to the underlying stream.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:149

void setStream(llvm::raw_ostream& Stream,
               bool Owns = REFERENCE_ONLY)

Description

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.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:133

Parameters

llvm::raw_ostream& Stream
bool Owns = REFERENCE_ONLY

void write_impl(const char* Ptr, size_t Size)

Description

The is the piece of the class that is implemented by subclasses. This writes the \p Size bytes starting at\p Ptr to the underlying stream. This function is guaranteed to only be called at a point at which it is safe for the subclass to install a new buffer via SetBuffer.

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:82

Parameters

const char* Ptr
The start of the data to be written. For buffered streams this is guaranteed to be the start of the buffer.
size_t Size
The number of bytes to be written.

~circular_raw_ostream()

Declared at: llvm/include/llvm/Support/circular_raw_ostream.h:117