GCC Middle and Back End API Reference
diagnostics::buffer Class Reference

#include <buffering.h>

Collaboration diagram for diagnostics::buffer:

Public Member Functions

 buffer (context &ctxt)
 ~buffer ()
void dump (FILE *out, int indent) const
void DEBUG_FUNCTION dump () const
int diagnostic_count (enum kind kind) const
bool empty_p () const
void move_to (buffer &dest)

Private Member Functions

void ensure_per_sink_buffers ()

Private Attributes

contextm_ctxt
auto_vec< per_sink_buffer * > * m_per_sink_buffers
counters m_diagnostic_counters

Friends

class context

Detailed Description

Class representing a buffer of zero or more diagnostics that
have been reported to a diagnostics::context, but which haven't
yet been flushed.

A diagnostics::buffer can be:

* flushed to the diagnostics::context, which issues
the diagnostics within the buffer to the output sinks
and checks for limits such as -fmax-errors=, or

* moved to another diagnostics::buffer, which moves the diagnostics
within the first buffer to the other buffer, appending them after any
existing diagnostics within the destination buffer, emptying the
source buffer, or

* cleared, which discards any diagnostics within the buffer
without issuing them to the output sinks.

Since a buffer needs to contain sink-specific data,
it's not possible to change the output sink(s) of the
diagnostics::context once any buffers are non-empty.

To simplify implementing output sinks, it's not possible
to change buffering on a diagnostics::context whilst within a
diagnostic group.   

Constructor & Destructor Documentation

◆ buffer()

diagnostics::buffer::buffer ( context & ctxt)
class diagnostics::buffer.   

References context, m_ctxt, and m_per_sink_buffers.

Referenced by move_to().

◆ ~buffer()

diagnostics::buffer::~buffer ( )

References m_per_sink_buffers.

Member Function Documentation

◆ diagnostic_count()

int diagnostics::buffer::diagnostic_count ( enum kind kind) const
inline

◆ dump() [1/2]

void DEBUG_FUNCTION diagnostics::buffer::dump ( ) const
inline

References DEBUG_FUNCTION, and dump().

Referenced by dump().

◆ dump() [2/2]

void diagnostics::buffer::dump ( FILE * out,
int indent ) const

◆ empty_p()

bool diagnostics::buffer::empty_p ( ) const

References m_per_sink_buffers.

◆ ensure_per_sink_buffers()

void diagnostics::buffer::ensure_per_sink_buffers ( )
private
Lazily get the output formats to create their own kind of buffers.
We can't change the output sinks on a context once this has been called
on any diagnostics::buffer instances for that context, since there's no
way to update all diagnostics::buffer instances for that context.   

References gcc_assert, m_ctxt, and m_per_sink_buffers.

Referenced by move_to(), and diagnostics::context::set_diagnostic_buffer().

◆ move_to()

void diagnostics::buffer::move_to ( buffer & dest)

◆ context

friend class context
friend

References context.

Referenced by buffer(), and context.

Field Documentation

◆ m_ctxt

context& diagnostics::buffer::m_ctxt
private

◆ m_diagnostic_counters

◆ m_per_sink_buffers


The documentation for this class was generated from the following files: