GCC Middle and Back End API Reference
diagnostic_buffer Class Reference

#include <diagnostic-buffer.h>

Collaboration diagram for diagnostic_buffer:

Public Member Functions

 diagnostic_buffer (diagnostic_context &ctxt)
 
 ~diagnostic_buffer ()
 
void dump (FILE *out, int indent) const
 
void DEBUG_FUNCTION dump () const
 
int diagnostic_count (diagnostic_t kind) const
 
bool empty_p () const
 
void move_to (diagnostic_buffer &dest)
 

Private Member Functions

void ensure_per_format_buffers ()
 

Private Attributes

diagnostic_contextm_ctxt
 
auto_vec< diagnostic_per_format_buffer * > * m_per_format_buffers
 
diagnostic_counters m_diagnostic_counters
 

Friends

class diagnostic_context
 

Detailed Description

Class representing a buffer of zero or more diagnostics that have been reported to a diagnostic_context, but which haven't yet been flushed. A diagnostic_buffer can be: * flushed to the diagnostic_context, which issues the diagnostics within the buffer to the output format and checks for limits such as -fmax-errors=, or * moved to another diagnostic_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 format. Since a buffer needs to contain output-format-specific data, it's not possible to change the output format of the diagnostic_context once any buffers are non-empty. To simplify implementing output formats, it's not possible to change buffering on a diagnostic_context whilst within a diagnostic group.

Constructor & Destructor Documentation

◆ diagnostic_buffer()

diagnostic_buffer::diagnostic_buffer ( diagnostic_context & ctxt)
class diagnostic_buffer.

References diagnostic_context, m_ctxt, and m_per_format_buffers.

Referenced by move_to().

◆ ~diagnostic_buffer()

diagnostic_buffer::~diagnostic_buffer ( )

References m_per_format_buffers.

Member Function Documentation

◆ diagnostic_count()

int diagnostic_buffer::diagnostic_count ( diagnostic_t kind) const
inline

References m_diagnostic_counters.

◆ dump() [1/2]

void DEBUG_FUNCTION diagnostic_buffer::dump ( ) const
inline

References DEBUG_FUNCTION, and dump().

Referenced by dump().

◆ dump() [2/2]

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

◆ empty_p()

bool diagnostic_buffer::empty_p ( ) const

References m_per_format_buffers.

◆ ensure_per_format_buffers()

void diagnostic_buffer::ensure_per_format_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 diagnostic_buffer instances for that context, since there's no way to update all diagnostic_buffer instances for that context.

References gcc_assert, m_ctxt, and m_per_format_buffers.

Referenced by move_to(), and diagnostic_context::set_diagnostic_buffer().

◆ move_to()

Friends And Related Symbol Documentation

◆ diagnostic_context

friend class diagnostic_context
friend

Field Documentation

◆ m_ctxt

diagnostic_context& diagnostic_buffer::m_ctxt
private

◆ m_diagnostic_counters

◆ m_per_format_buffers


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