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

#include <context.h>

Collaboration diagram for diagnostics::context:

Data Structures

struct  urlifier_stack_node

Public Types

typedef void(* set_locations_callback_t) (const context &, diagnostic_info *)

Public Member Functions

void initialize (int n_opts)
void color_init (int value)
void urls_init (int value)
void set_pretty_printer (std::unique_ptr< pretty_printer > pp)
void refresh_output_sinks ()
void finish ()
void dump (FILE *out, int indent) const
void DEBUG_FUNCTION dump () const
logging::loggerget_logger ()
bool execution_failed_p () const
void set_original_argv (unique_argv original_argv)
const char *const * get_original_argv ()
void set_set_locations_callback (set_locations_callback_t cb)
void initialize_input_context (diagnostic_input_charset_callback ccb, bool should_skip_bom)
void begin_group ()
void end_group ()
void push_nesting_level ()
void pop_nesting_level ()
void set_nesting_level (int new_level)
bool warning_enabled_at (location_t loc, option_id opt_id)
bool option_unspecified_p (option_id opt_id) const
bool emit_diagnostic_with_group (enum kind kind, rich_location &richloc, const metadata *metadata, option_id opt_id, const char *gmsgid,...) ATTRIBUTE_GCC_DIAG(6
bool bool emit_diagnostic_with_group_va (enum kind kind, rich_location &richloc, const metadata *metadata, option_id opt_id, const char *gmsgid, va_list *ap) ATTRIBUTE_GCC_DIAG(6
bool bool bool report_diagnostic (diagnostic_info *)
void report_verbatim (text_info &)
void report_global_digraph (const lazily_created< digraphs::digraph > &)
enum kind classify_diagnostic (option_id opt_id, enum kind new_kind, location_t where)
void push_diagnostics (location_t where)
void pop_diagnostics (location_t where)
void maybe_show_locus (const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, pretty_printer &pp, source_effect_info *effect_info)
void maybe_show_locus_as_html (const rich_location &richloc, const source_printing_options &opts, enum kind diagnostic_kind, xml::printer &xp, source_effect_info *effect_info, html_label_writer *label_writer)
void emit_diagram (const diagram &diag)
void set_sink (std::unique_ptr< sink > sink_)
void set_text_art_charset (enum diagnostic_text_art_charset charset)
void set_client_data_hooks (std::unique_ptr< client_data_hooks > hooks)
void push_owned_urlifier (std::unique_ptr< urlifier >)
void push_borrowed_urlifier (const urlifier &)
void pop_urlifier ()
void initialize_fixits_change_set ()
void set_warning_as_error_requested (bool val)
void set_report_bug (bool val)
void set_extra_output_kind (enum diagnostics_extra_output_kind kind)
void set_show_cwe (bool val)
void set_show_rules (bool val)
void set_show_highlight_colors (bool val)
void set_path_format (enum diagnostic_path_format val)
void set_show_path_depths (bool val)
void set_show_option_requested (bool val)
void set_show_nesting (bool val)
void set_show_nesting_locations (bool val)
void set_show_nesting_levels (bool val)
void set_max_errors (int val)
void set_escape_format (enum diagnostics_escape_format val)
void set_format_decoder (printer_fn format_decoder)
void set_prefixing_rule (diagnostic_prefixing_rule_t rule)
bool warning_as_error_requested_p () const
bool show_path_depths_p () const
sinkget_sink (size_t idx) const
enum diagnostic_path_format get_path_format () const
enum diagnostics_escape_format get_escape_format () const
file_cacheget_file_cache () const
changes::change_setget_fixits_change_set () const
const client_data_hooksget_client_data_hooks () const
const logical_locations::managerget_logical_location_manager () const
const urlifierget_urlifier () const
text_art::themeget_diagram_theme () const
int & diagnostic_count (enum kind kind)
int diagnostic_count (enum kind kind) const
bool option_enabled_p (option_id opt_id) const
char * make_option_name (option_id opt_id, enum kind orig_diag_kind, enum kind diag_kind) const
char * make_option_url (option_id opt_id) const
void set_option_id_manager (std::unique_ptr< option_id_manager > option_id_mgr, unsigned lang_mask)
unsigned get_lang_mask () const
bool diagnostic_impl (rich_location *, const metadata *, option_id, const char *, va_list *, enum kind) ATTRIBUTE_GCC_DIAG(5
bool bool diagnostic_n_impl (rich_location *, const metadata *, option_id, unsigned HOST_WIDE_INT, const char *, const char *, va_list *, enum kind) ATTRIBUTE_GCC_DIAG(7
bool bool int get_diagnostic_nesting_level () const
char * build_indent_prefix () const
int pch_save (FILE *f)
int pch_restore (FILE *f)
void set_diagnostic_buffer (buffer *)
bufferget_diagnostic_buffer () const
void clear_diagnostic_buffer (buffer &)
void flush_diagnostic_buffer (buffer &)
std::unique_ptr< pretty_printerclone_printer () const
pretty_printerget_reference_printer () const
void add_sink (std::unique_ptr< sink >)
void remove_all_output_sinks ()
bool supports_fnotice_on_stderr_p () const
void set_abort_on_error (bool val)
auto & get_classification_history ()
void set_main_input_filename (const char *filename)
void set_permissive_option (option_id opt_permissive)
void set_fatal_errors (bool fatal_errors)
void set_internal_error_callback (void(*cb)(context *, const char *, va_list *))
void set_adjust_diagnostic_info_callback (void(*cb)(const context &, diagnostic_info *))
void inhibit_notes ()
source_printing_optionsget_source_printing_options ()
const source_printing_optionsget_source_printing_options () const
column_optionsget_column_options ()
const column_optionsget_column_options () const
void set_caret_max_width (int value)

Data Fields

bool m_show_column
bool m_pedantic_errors
bool m_permissive
bool m_inhibit_warnings
bool m_warn_system_headers
void * m_client_aux_data
location_t m_last_location

Private Member Functions

void error_recursion () ATTRIBUTE_NORETURN
bool diagnostic_enabled (diagnostic_info *diagnostic)
void get_any_inlining_info (diagnostic_info *diagnostic)
void check_max_errors (bool flush)
void action_after_output (enum kind diag_kind)
void inhibit_notes_in_group (bool inhibit=true)
bool notes_inhibited_in_group () const

Private Attributes

pretty_printerm_reference_printer
file_cachem_file_cache
counters m_diagnostic_counters
bool m_warning_as_error_requested
int m_n_opts
option_classifier m_option_classifier
bool m_show_cwe
bool m_show_rules
enum diagnostic_path_format m_path_format
bool m_show_path_depths
bool m_show_option_requested
bool m_abort_on_error
option_id m_opt_permissive
bool m_fatal_errors
int m_max_errors
struct { 
   text_starter_fn   m_begin_diagnostic 
   start_span_fn< to_text >   m_text_start_span 
   start_span_fn< to_html >   m_html_start_span 
   text_finalizer_fn   m_end_diagnostic 
m_text_callbacks
void(* m_internal_error )(context *, const char *, va_list *)
void(* m_adjust_diagnostic_info )(const context &, diagnostic_info *)
option_id_managerm_option_id_mgr
unsigned m_lang_mask
auto_vec< urlifier_stack_node > * m_urlifier_stack
int m_lock
bool m_inhibit_notes_p
source_printing_options m_source_printing
column_options m_column_options
bool m_report_bug
enum diagnostics_extra_output_kind m_extra_output_kind
enum diagnostics_escape_format m_escape_format
changes::change_setm_fixits_change_set
struct { 
   int   m_group_nesting_depth 
   int   m_diagnostic_nesting_level 
   int   m_emission_count 
   int   m_inhibiting_notes_from 
m_diagnostic_groups
auto_vec< sink * > m_sinks
set_locations_callback_t m_set_locations_cb
client_data_hooksm_client_data_hooks
struct { 
   text_art::theme *   m_theme 
m_diagrams
char ** m_original_argv
bufferm_diagnostic_buffer
logging::loggerm_logger

Friends

class source_print_policy
class text_sink
class buffer
text_starter_fntext_starter (context *dc)
start_span_fn< to_text > & start_span (context *dc)
text_finalizer_fntext_finalizer (context *dc)

Detailed Description

This class encapsulates the state of the diagnostics subsystem
as a whole (either directly, or via owned objects of other classes, to
avoid global variables).

It has responsibility for:
- being a central place for clients to report diagnostics
- reporting those diagnostics to zero or more output sinks
  (e.g. text vs SARIF)
- providing a "dump" member function for a debug dump of the state of
  the diagnostics subsytem
- direct vs buffered diagnostics (see class diagnostics::buffer)
- tracking the original argv of the program (for SARIF output)
- crash-handling

It delegates responsibility to various other classes:
- the various output sinks (instances of diagnostics::sink
  subclasses)
- formatting of messages (class pretty_printer)
- an optional urlifier to inject URLs into formatted messages
- counting the number of diagnostics reported of each kind
  (class diagnostics::counters)
- calling out to a option_id_manager to determine if
  a particular warning is enabled or disabled
- tracking pragmas that enable/disable warnings in a range of
  source code
- a cache for use when quoting the user's source code (class file_cache)
- a text_art::theme
- a diagnostics::changes::change_set for generating patches from fix-it hints
- diagnostics::client_data_hooks for metadata.

Try to avoid adding new responsibilities to this class itself, to avoid
the "blob" anti-pattern.   

Member Typedef Documentation

◆ set_locations_callback_t

typedef void(* diagnostics::context::set_locations_callback_t) (const context &, diagnostic_info *)

Member Function Documentation

◆ action_after_output()

void diagnostics::context::action_after_output ( enum kind diag_kind)
private
Take any action which is expected to happen after the diagnostic
is written out.  This function does not always return.   

References diagnostics::bt_callback(), bt_err_callback(), count, FATAL_EXIT_CODE, finish(), fnotice(), gcc_unreachable, ICE_EXIT_CODE, m_abort_on_error, m_fatal_errors, m_report_bug, and real_abort().

Referenced by error_recursion(), flush_diagnostic_buffer(), and report_diagnostic().

◆ add_sink()

◆ begin_group()

void diagnostics::context::begin_group ( )

◆ build_indent_prefix()

char * diagnostics::context::build_indent_prefix ( ) const

◆ check_max_errors()

void diagnostics::context::check_max_errors ( bool flush)
private
Check if we've met the maximum error limit, and if so fatally exit
with a message.
FLUSH indicates whether a diagnostics::context::finish call is needed.   

References count, diagnostic_count(), FATAL_EXIT_CODE, finish(), fnotice(), and m_max_errors.

Referenced by flush_diagnostic_buffer(), and report_diagnostic().

◆ classify_diagnostic()

◆ clear_diagnostic_buffer()

void diagnostics::context::clear_diagnostic_buffer ( buffer & buffer_)

◆ clone_printer()

std::unique_ptr< pretty_printer > diagnostics::context::clone_printer ( ) const
inline

References m_reference_printer.

◆ color_init()

void diagnostics::context::color_init ( int value)
Maybe initialize the color support. We require clients to do this
explicitly, since most clients don't want color.  When called
without a VALUE, it initializes with DIAGNOSTICS_COLOR_DEFAULT.   

References colorize_init(), DIAGNOSTICS_COLOR_AUTO, m_reference_printer, m_sinks, and pp_show_color().

Referenced by diagnostic_color_init().

◆ diagnostic_count() [1/2]

int & diagnostics::context::diagnostic_count ( enum kind kind)
inline

◆ diagnostic_count() [2/2]

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

References m_diagnostic_counters.

◆ diagnostic_enabled()

bool diagnostics::context::diagnostic_enabled ( diagnostic_info * diagnostic)
private
Returns whether a DIAGNOSTIC should be printed, and adjusts diagnostic->kind
as appropriate for #pragma GCC diagnostic and -Werror=foo.   

References diagnostics::any, get_any_inlining_info(), m_opt_permissive, m_option_classifier, option_enabled_p(), and option_unspecified_p().

Referenced by report_diagnostic(), and warning_enabled_at().

◆ diagnostic_impl()

bool diagnostics::context::diagnostic_impl ( rich_location * richloc,
const metadata * metadata,
option_id opt_id,
const char * gmsgid,
va_list * ap,
enum kind kind )
Implement emit_diagnostic, inform, warning, warning_at, pedwarn,
permerror, error, error_at, error_at, sorry, fatal_error, internal_error,
and internal_error_no_backtrace, as documented and defined below.   

References ap, diagnostic_set_info(), diagnostics::logging::log_function_params::log_param_kind(), diagnostics::logging::log_function_params::log_param_option_id(), diagnostics::logging::log_function_params::log_param_string(), diagnostics::option_id::m_idx, m_logger, diagnostic::m_metadata, m_opt_permissive, m_permissive, and report_diagnostic().

Referenced by emit_diagnostic_with_group_va().

◆ diagnostic_n_impl()

bool diagnostics::context::diagnostic_n_impl ( rich_location * richloc,
const metadata * metadata,
option_id opt_id,
unsigned HOST_WIDE_INT n,
const char * singular_gmsgid,
const char * plural_gmsgid,
va_list * ap,
enum kind kind )

◆ dump() [1/2]

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

References DEBUG_FUNCTION, and dump().

Referenced by dump(), and finish().

◆ dump() [2/2]

void diagnostics::context::dump ( FILE * outfile,
int indent ) const

◆ emit_diagnostic_with_group()

bool diagnostics::context::emit_diagnostic_with_group ( enum kind kind ,
rich_location & richloc,
const metadata * metadata,
option_id opt_id,
const char * gmsgid,
... )
Emit a diagnostic within a diagnostic group on this context.   

References ap, begin_group(), emit_diagnostic_with_group_va(), and end_group().

Referenced by diagnostics::open_html_output_file(), and diagnostics::output_file::try_to_open().

◆ emit_diagnostic_with_group_va()

bool diagnostics::context::emit_diagnostic_with_group_va ( enum kind kind ,
rich_location & richloc,
const metadata * metadata,
option_id opt_id,
const char * gmsgid,
va_list * ap )
As above, but taking a va_list *.   

References ap, begin_group(), diagnostic_impl(), and end_group().

Referenced by emit_diagnostic_with_group().

◆ emit_diagram()

void diagnostics::context::emit_diagram ( const diagram & diag)
Emit DIAGRAM to this context, respecting the output format.   

References m_diagrams, and m_sinks.

◆ end_group()

◆ error_recursion()

void diagnostics::context::error_recursion ( )
private
Inform the user that an error occurred while trying to report some
other error.  This indicates catastrophic internal inconsistencies,
so give up now.  But do try to flush out the previous error.
This mustn't use internal_error, that will cause infinite recursion.   

References action_after_output(), fnotice(), m_lock, m_reference_printer, pp_newline_and_flush(), and real_abort().

Referenced by report_diagnostic().

◆ execution_failed_p()

bool diagnostics::context::execution_failed_p ( ) const
Return true if sufficiently severe diagnostics have been seen that
we ought to exit with a non-zero exit code.   

References diagnostic_count().

Referenced by diagnostics::sarif_invocation::prepare_to_flush().

◆ finish()

◆ flush_diagnostic_buffer()

void diagnostics::context::flush_diagnostic_buffer ( buffer & buffer_)

◆ get_any_inlining_info()

void diagnostics::context::get_any_inlining_info ( diagnostic_info * diagnostic)
private
Update the inlining info in this context for a DIAGNOSTIC.   

References diagnostic_location(), in_system_header_at(), and m_set_locations_cb.

Referenced by diagnostic_enabled().

◆ get_classification_history()

auto & diagnostics::context::get_classification_history ( )
inline

References m_option_classifier.

◆ get_client_data_hooks()

const client_data_hooks * diagnostics::context::get_client_data_hooks ( ) const
inline

◆ get_column_options() [1/2]

column_options & diagnostics::context::get_column_options ( )
inline

◆ get_column_options() [2/2]

const column_options & diagnostics::context::get_column_options ( ) const
inline

References m_column_options.

◆ get_diagnostic_buffer()

buffer * diagnostics::context::get_diagnostic_buffer ( ) const
inline

References buffer, and m_diagnostic_buffer.

◆ get_diagnostic_nesting_level()

bool bool int diagnostics::context::get_diagnostic_nesting_level ( ) const
inline

◆ get_diagram_theme()

text_art::theme * diagnostics::context::get_diagram_theme ( ) const
inline

References m_diagrams.

Referenced by diagnostics::use_unicode_p().

◆ get_escape_format()

enum diagnostics_escape_format diagnostics::context::get_escape_format ( ) const
inline

References m_escape_format.

◆ get_file_cache()

file_cache & diagnostics::context::get_file_cache ( ) const
inline

References gcc_assert, and m_file_cache.

Referenced by report_diagnostic().

◆ get_fixits_change_set()

changes::change_set * diagnostics::context::get_fixits_change_set ( ) const
inline

References m_fixits_change_set.

◆ get_lang_mask()

unsigned diagnostics::context::get_lang_mask ( ) const
inline

References m_lang_mask.

◆ get_logger()

logging::logger * diagnostics::context::get_logger ( )
inline

◆ get_logical_location_manager()

const logical_locations::manager * diagnostics::context::get_logical_location_manager ( ) const

References m_client_data_hooks.

◆ get_original_argv()

const char *const * diagnostics::context::get_original_argv ( )
inline

References m_original_argv.

◆ get_path_format()

enum diagnostic_path_format diagnostics::context::get_path_format ( ) const
inline

References m_path_format.

◆ get_reference_printer()

◆ get_sink()

sink & diagnostics::context::get_sink ( size_t idx) const

References gcc_assert, and m_sinks.

◆ get_source_printing_options() [1/2]

◆ get_source_printing_options() [2/2]

const source_printing_options & diagnostics::context::get_source_printing_options ( ) const
inline

References m_source_printing.

◆ get_urlifier()

const urlifier * diagnostics::context::get_urlifier ( ) const

References m_urlifier_stack.

◆ inhibit_notes()

void diagnostics::context::inhibit_notes ( )
inline

References m_inhibit_notes_p.

◆ inhibit_notes_in_group()

void diagnostics::context::inhibit_notes_in_group ( bool inhibit = true)
private
State whether we should inhibit notes in the current diagnostic_group and
its future children if any.   

References gcc_assert, and m_diagnostic_groups.

Referenced by end_group(), pop_nesting_level(), and report_diagnostic().

◆ initialize()

◆ initialize_fixits_change_set()

void diagnostics::context::initialize_fixits_change_set ( )

◆ initialize_input_context()

void diagnostics::context::initialize_input_context ( diagnostic_input_charset_callback ccb,
bool should_skip_bom )
Create the file_cache, if not already created, and tell it how to
translate files on input.   

References m_file_cache.

Referenced by diagnostic_initialize_input_context().

◆ make_option_name()

char * diagnostics::context::make_option_name ( option_id opt_id,
enum kind orig_diag_kind,
enum kind diag_kind ) const
inline

References m_option_id_mgr.

◆ make_option_url()

char * diagnostics::context::make_option_url ( option_id opt_id) const
inline

References m_option_id_mgr.

◆ maybe_show_locus()

void diagnostics::context::maybe_show_locus ( const rich_location & richloc,
const source_printing_options & opts,
enum kind diagnostic_kind,
pretty_printer & pp,
source_effect_info * effects )
As per diagnostics::source_print_policy::print, but don't print anything
if source printing is disabled, or if the location hasn't changed.   

References BUILTINS_LOCATION, diagnostics::source_printing_options::enabled, m_last_location, diagnostics::source_print_policy::print(), and source_print_policy.

Referenced by diagnostic_show_locus().

◆ maybe_show_locus_as_html()

void diagnostics::context::maybe_show_locus_as_html ( const rich_location & richloc,
const source_printing_options & opts,
enum kind diagnostic_kind,
xml::printer & xp,
source_effect_info * effects,
html_label_writer * label_writer )
As above, but print in HTML form to XP.
If non-null, use LABEL_WRITER when writing labelled ranges.   

References BUILTINS_LOCATION, diagnostics::source_printing_options::enabled, m_last_location, diagnostics::source_print_policy::print_as_html(), and source_print_policy.

Referenced by diagnostic_show_locus_as_html().

◆ notes_inhibited_in_group()

bool diagnostics::context::notes_inhibited_in_group ( ) const
private
Return whether notes must be inhibited in the current diagnostic_group.   

References m_diagnostic_groups.

Referenced by report_diagnostic().

◆ option_enabled_p()

bool diagnostics::context::option_enabled_p ( option_id opt_id) const
inline

◆ option_unspecified_p()

bool diagnostics::context::option_unspecified_p ( option_id opt_id) const
inline

References m_option_classifier.

Referenced by diagnostic_enabled().

◆ pch_restore()

int diagnostics::context::pch_restore ( FILE * f)
inline

References m_option_classifier.

◆ pch_save()

int diagnostics::context::pch_save ( FILE * f)
inline

References m_option_classifier.

◆ pop_diagnostics()

void diagnostics::context::pop_diagnostics ( location_t where)
inline

◆ pop_nesting_level()

void diagnostics::context::pop_nesting_level ( )

◆ pop_urlifier()

◆ push_borrowed_urlifier()

void diagnostics::context::push_borrowed_urlifier ( const urlifier & loan)

References gcc_assert, and m_urlifier_stack.

◆ push_diagnostics()

void diagnostics::context::push_diagnostics ( location_t where)
inline

◆ push_nesting_level()

void diagnostics::context::push_nesting_level ( )

References m_diagnostic_groups.

◆ push_owned_urlifier()

void diagnostics::context::push_owned_urlifier ( std::unique_ptr< urlifier > ptr)

References gcc_assert, and m_urlifier_stack.

◆ refresh_output_sinks()

void diagnostics::context::refresh_output_sinks ( )
Give all output sinks a chance to rebuild their pretty_printer.   

References m_sinks.

Referenced by set_pretty_printer().

◆ remove_all_output_sinks()

void diagnostics::context::remove_all_output_sinks ( )

References m_sinks.

Referenced by set_sink().

◆ report_diagnostic()

◆ report_global_digraph()

void diagnostics::context::report_global_digraph ( const lazily_created< digraphs::digraph > & ldg)

References m_sinks.

◆ report_verbatim()

void diagnostics::context::report_verbatim ( text_info & text)

◆ set_abort_on_error()

void diagnostics::context::set_abort_on_error ( bool val)
inline

References m_abort_on_error.

Referenced by setup_core_dumping().

◆ set_adjust_diagnostic_info_callback()

void diagnostics::context::set_adjust_diagnostic_info_callback ( void(* cb )(const context &, diagnostic_info *))
inline

◆ set_caret_max_width()

void diagnostics::context::set_caret_max_width ( int value)
Set caret_max_width to value.   

References get_reference_printer(), get_terminal_width(), INT_MAX, m_source_printing, and pp_buffer().

Referenced by common_handle_option(), and initialize().

◆ set_client_data_hooks()

void diagnostics::context::set_client_data_hooks ( std::unique_ptr< client_data_hooks > hooks)

◆ set_diagnostic_buffer()

void diagnostics::context::set_diagnostic_buffer ( buffer * buffer_)
Methods fns of diagnostics::context relating to buffering.   
If BUFFER_ is non-null, use BUFFER as the active diagnostics::buffer on
this context.  BUFFER is borrowed.

If BUFFER_ is null, stop any buffering on this context until the next call
to this function.   

References buffer, diagnostics::buffer::ensure_per_sink_buffers(), gcc_assert, m_diagnostic_buffer, m_diagnostic_groups, diagnostics::buffer::m_per_sink_buffers, and m_sinks.

Referenced by finish().

◆ set_escape_format()

void diagnostics::context::set_escape_format ( enum diagnostics_escape_format val)
inline

◆ set_extra_output_kind()

void diagnostics::context::set_extra_output_kind ( enum diagnostics_extra_output_kind kind)
inline

References m_extra_output_kind.

Referenced by common_handle_option().

◆ set_fatal_errors()

void diagnostics::context::set_fatal_errors ( bool fatal_errors)
inline

References m_fatal_errors.

Referenced by common_handle_option().

◆ set_format_decoder()

void diagnostics::context::set_format_decoder ( printer_fn format_decoder)
Set FORMAT_DECODER on the reference printer and on the pretty_printer
of all output sinks.   

References m_reference_printer, m_sinks, and pp_format_decoder().

Referenced by tree_diagnostics_defaults().

◆ set_internal_error_callback()

void diagnostics::context::set_internal_error_callback ( void(* cb )(context *, const char *, va_list *))
inline

References m_internal_error.

◆ set_main_input_filename()

void diagnostics::context::set_main_input_filename ( const char * filename)

◆ set_max_errors()

void diagnostics::context::set_max_errors ( int val)
inline

References m_max_errors.

Referenced by common_handle_option().

◆ set_nesting_level()

void diagnostics::context::set_nesting_level ( int new_level)

References m_diagnostic_groups.

◆ set_option_id_manager()

void diagnostics::context::set_option_id_manager ( std::unique_ptr< option_id_manager > option_id_mgr,
unsigned lang_mask )

References m_lang_mask, and m_option_id_mgr.

◆ set_original_argv()

void diagnostics::context::set_original_argv ( unique_argv original_argv)

◆ set_path_format()

void diagnostics::context::set_path_format ( enum diagnostic_path_format val)
inline

References m_path_format.

Referenced by common_handle_option().

◆ set_permissive_option()

void diagnostics::context::set_permissive_option ( option_id opt_permissive)
inline

References m_opt_permissive.

◆ set_prefixing_rule()

void diagnostics::context::set_prefixing_rule ( diagnostic_prefixing_rule_t rule)

◆ set_pretty_printer()

void diagnostics::context::set_pretty_printer ( std::unique_ptr< pretty_printer > pp)
Set PP as the reference printer for this context.
Refresh all output sinks.   

References m_reference_printer, and refresh_output_sinks().

◆ set_report_bug()

void diagnostics::context::set_report_bug ( bool val)
inline

References m_report_bug.

Referenced by common_handle_option().

◆ set_set_locations_callback()

void diagnostics::context::set_set_locations_callback ( set_locations_callback_t cb)
inline

References m_set_locations_cb.

Referenced by tree_diagnostics_defaults().

◆ set_show_cwe()

void diagnostics::context::set_show_cwe ( bool val)
inline

References m_show_cwe.

Referenced by common_handle_option().

◆ set_show_highlight_colors()

void diagnostics::context::set_show_highlight_colors ( bool val)

◆ set_show_nesting()

void diagnostics::context::set_show_nesting ( bool val)

References m_sinks.

Referenced by common_handle_option().

◆ set_show_nesting_levels()

void diagnostics::context::set_show_nesting_levels ( bool val)

References m_sinks.

Referenced by common_handle_option().

◆ set_show_nesting_locations()

void diagnostics::context::set_show_nesting_locations ( bool val)

References m_sinks.

Referenced by common_handle_option().

◆ set_show_option_requested()

void diagnostics::context::set_show_option_requested ( bool val)
inline

References m_show_option_requested.

Referenced by common_handle_option().

◆ set_show_path_depths()

void diagnostics::context::set_show_path_depths ( bool val)
inline

References m_show_path_depths.

Referenced by common_handle_option().

◆ set_show_rules()

void diagnostics::context::set_show_rules ( bool val)
inline

References m_show_rules.

Referenced by common_handle_option().

◆ set_sink()

void diagnostics::context::set_sink ( std::unique_ptr< sink > sink_)

◆ set_text_art_charset()

void diagnostics::context::set_text_art_charset ( enum diagnostic_text_art_charset charset)
Initialize this context's m_diagrams based on CHARSET.
Specifically, make a text_art::theme object for m_diagrams.m_theme,
(or nullptr for "no diagrams").   

References DIAGNOSTICS_TEXT_ART_CHARSET_ASCII, DIAGNOSTICS_TEXT_ART_CHARSET_EMOJI, DIAGNOSTICS_TEXT_ART_CHARSET_NONE, DIAGNOSTICS_TEXT_ART_CHARSET_UNICODE, gcc_unreachable, and m_diagrams.

Referenced by common_handle_option(), driver_handle_option(), and initialize().

◆ set_warning_as_error_requested()

void diagnostics::context::set_warning_as_error_requested ( bool val)
inline

◆ show_path_depths_p()

bool diagnostics::context::show_path_depths_p ( ) const
inline

◆ supports_fnotice_on_stderr_p()

bool diagnostics::context::supports_fnotice_on_stderr_p ( ) const
Return true if there are no machine-readable formats writing to stderr.   

References m_sinks.

◆ urls_init()

void diagnostics::context::urls_init ( int value)
Initialize URL support within this context based on VALUE,
handling "auto".   

References determine_url_format(), DIAGNOSTICS_URL_AUTO, m_reference_printer, and m_sinks.

Referenced by diagnostic_urls_init().

◆ warning_as_error_requested_p()

bool diagnostics::context::warning_as_error_requested_p ( ) const
inline

◆ warning_enabled_at()

bool diagnostics::context::warning_enabled_at ( location_t loc,
option_id opt_id )
Returns whether warning OPT_ID is enabled at LOC.   

References diagnostic_enabled(), diagnostic_report_warnings_p, and line_table.

◆ buffer

◆ source_print_policy

◆ start_span

start_span_fn< to_text > & start_span ( context * dc)
friend
Client supplied function called between disjoint spans of source code,
so that the context can print
something to indicate that a new span of source code has begun.   

References m_text_callbacks, and m_text_start_span.

◆ text_finalizer

text_finalizer_fn & text_finalizer ( context * dc)
friend
Client supplied function called after a diagnostic message is
displayed (for text-based diagnostic output).   

References m_end_diagnostic, and m_text_callbacks.

◆ text_sink

friend class text_sink
friend

References text_sink.

Referenced by initialize(), and text_sink.

◆ text_starter

text_starter_fn & text_starter ( context * dc)
friend
Client supplied function to announce a diagnostic
(for text-based diagnostic output).   

References m_begin_diagnostic, and m_text_callbacks.

Field Documentation

◆ m_abort_on_error

bool diagnostics::context::m_abort_on_error
private

◆ m_adjust_diagnostic_info

void(* diagnostics::context::m_adjust_diagnostic_info) (const context &, diagnostic_info *)
private

◆ m_begin_diagnostic

text_starter_fn diagnostics::context::m_begin_diagnostic

Referenced by text_starter.

◆ m_client_aux_data

void* diagnostics::context::m_client_aux_data

Referenced by initialize().

◆ m_client_data_hooks

client_data_hooks* diagnostics::context::m_client_data_hooks
private

◆ m_column_options

column_options diagnostics::context::m_column_options
private

◆ m_diagnostic_buffer

buffer* diagnostics::context::m_diagnostic_buffer
private

◆ m_diagnostic_counters

counters diagnostics::context::m_diagnostic_counters
private

◆ [struct]

◆ m_diagnostic_nesting_level

int diagnostics::context::m_diagnostic_nesting_level

◆ [struct]

struct { ... } diagnostics::context::m_diagrams

◆ m_emission_count

int diagnostics::context::m_emission_count

◆ m_end_diagnostic

text_finalizer_fn diagnostics::context::m_end_diagnostic

Referenced by text_finalizer.

◆ m_escape_format

enum diagnostics_escape_format diagnostics::context::m_escape_format
private

◆ m_extra_output_kind

enum diagnostics_extra_output_kind diagnostics::context::m_extra_output_kind
private

◆ m_fatal_errors

bool diagnostics::context::m_fatal_errors
private

◆ m_file_cache

file_cache* diagnostics::context::m_file_cache
private

◆ m_fixits_change_set

changes::change_set* diagnostics::context::m_fixits_change_set
private

◆ m_group_nesting_depth

int diagnostics::context::m_group_nesting_depth

◆ m_html_start_span

start_span_fn<to_html> diagnostics::context::m_html_start_span

◆ m_inhibit_notes_p

bool diagnostics::context::m_inhibit_notes_p
private

◆ m_inhibit_warnings

bool diagnostics::context::m_inhibit_warnings

◆ m_inhibiting_notes_from

int diagnostics::context::m_inhibiting_notes_from

◆ m_internal_error

void(* diagnostics::context::m_internal_error) (context *, const char *, va_list *)
private

◆ m_lang_mask

unsigned diagnostics::context::m_lang_mask
private

◆ m_last_location

location_t diagnostics::context::m_last_location

◆ m_lock

int diagnostics::context::m_lock
private

◆ m_logger

◆ m_max_errors

int diagnostics::context::m_max_errors
private

◆ m_n_opts

int diagnostics::context::m_n_opts
private

Referenced by initialize().

◆ m_opt_permissive

option_id diagnostics::context::m_opt_permissive
private

◆ m_option_classifier

◆ m_option_id_mgr

option_id_manager* diagnostics::context::m_option_id_mgr
private

◆ m_original_argv

char** diagnostics::context::m_original_argv
private

◆ m_path_format

enum diagnostic_path_format diagnostics::context::m_path_format
private

◆ m_pedantic_errors

bool diagnostics::context::m_pedantic_errors

◆ m_permissive

bool diagnostics::context::m_permissive

Referenced by diagnostic_impl(), and initialize().

◆ m_reference_printer

◆ m_report_bug

bool diagnostics::context::m_report_bug
private

◆ m_set_locations_cb

set_locations_callback_t diagnostics::context::m_set_locations_cb
private

◆ m_show_column

◆ m_show_cwe

bool diagnostics::context::m_show_cwe
private

Referenced by initialize(), and set_show_cwe().

◆ m_show_option_requested

bool diagnostics::context::m_show_option_requested
private

◆ m_show_path_depths

bool diagnostics::context::m_show_path_depths
private

◆ m_show_rules

bool diagnostics::context::m_show_rules
private

Referenced by initialize(), and set_show_rules().

◆ m_sinks

◆ m_source_printing

source_printing_options diagnostics::context::m_source_printing
private

◆ [struct]

struct { ... } diagnostics::context::m_text_callbacks

◆ m_text_start_span

start_span_fn<to_text> diagnostics::context::m_text_start_span

Referenced by start_span.

◆ m_theme

text_art::theme* diagnostics::context::m_theme

◆ m_urlifier_stack

auto_vec<urlifier_stack_node>* diagnostics::context::m_urlifier_stack
private

◆ m_warn_system_headers

bool diagnostics::context::m_warn_system_headers

◆ m_warning_as_error_requested

bool diagnostics::context::m_warning_as_error_requested
private

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