GCC Middle and Back End API Reference
diagnostic_context Class Reference

#include <diagnostic.h>

Collaboration diagram for diagnostic_context:

Public Types

typedef void(*) set_locations_callback_t(diagnostic_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) const
 
void DEBUG_FUNCTION dump () const
 
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 ()
 
bool warning_enabled_at (location_t loc, diagnostic_option_id option_id)
 
bool option_unspecified_p (diagnostic_option_id option_id) const
 
bool emit_diagnostic_with_group (diagnostic_t kind, rich_location &richloc, const diagnostic_metadata *metadata, diagnostic_option_id option_id, const char *gmsgid,...) ATTRIBUTE_GCC_DIAG(6
 
bool bool emit_diagnostic_with_group_va (diagnostic_t kind, rich_location &richloc, const diagnostic_metadata *metadata, diagnostic_option_id option_id, const char *gmsgid, va_list *ap) ATTRIBUTE_GCC_DIAG(6
 
bool bool bool report_diagnostic (diagnostic_info *)
 
void report_verbatim (text_info &)
 
diagnostic_t classify_diagnostic (diagnostic_option_id option_id, diagnostic_t 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, diagnostic_t diagnostic_kind, pretty_printer &pp, diagnostic_source_effect_info *effect_info)
 
void emit_diagram (const diagnostic_diagram &diagram)
 
void set_output_format (std::unique_ptr< diagnostic_output_format > output_format)
 
void set_text_art_charset (enum diagnostic_text_art_charset charset)
 
void set_client_data_hooks (std::unique_ptr< diagnostic_client_data_hooks > hooks)
 
void set_urlifier (std::unique_ptr< urlifier >)
 
void override_urlifier (urlifier *)
 
void create_edit_context ()
 
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_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
 
diagnostic_output_formatget_output_format (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
 
edit_contextget_edit_context () const
 
const diagnostic_client_data_hooksget_client_data_hooks () const
 
urlifierget_urlifier () const
 
text_art::theme * get_diagram_theme () const
 
int & diagnostic_count (diagnostic_t kind)
 
int diagnostic_count (diagnostic_t kind) const
 
bool option_enabled_p (diagnostic_option_id option_id) const
 
char * make_option_name (diagnostic_option_id option_id, diagnostic_t orig_diag_kind, diagnostic_t diag_kind) const
 
char * make_option_url (diagnostic_option_id option_id) const
 
void set_option_manager (std::unique_ptr< diagnostic_option_manager > mgr, unsigned lang_mask)
 
unsigned get_lang_mask () const
 
bool diagnostic_impl (rich_location *, const diagnostic_metadata *, diagnostic_option_id, const char *, va_list *, diagnostic_t) ATTRIBUTE_GCC_DIAG(5
 
bool bool diagnostic_n_impl (rich_location *, const diagnostic_metadata *, diagnostic_option_id, unsigned HOST_WIDE_INT, const char *, const char *, va_list *, diagnostic_t) 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 (diagnostic_buffer *)
 
diagnostic_bufferget_diagnostic_buffer () const
 
void clear_diagnostic_buffer (diagnostic_buffer &)
 
void flush_diagnostic_buffer (diagnostic_buffer &)
 
std::unique_ptr< pretty_printerclone_printer () const
 
pretty_printerget_reference_printer () const
 
void add_sink (std::unique_ptr< diagnostic_output_format >)
 
bool supports_fnotice_on_stderr_p () const
 

Data Fields

bool m_abort_on_error
 
bool m_show_column
 
bool m_pedantic_errors
 
bool m_permissive
 
int m_opt_permissive
 
bool m_fatal_errors
 
bool m_inhibit_warnings
 
bool m_warn_system_headers
 
void(* m_internal_error )(diagnostic_context *, const char *, va_list *)
 
void(* m_adjust_diagnostic_info )(diagnostic_context *, diagnostic_info *)
 
void * m_client_aux_data
 
location_t m_last_location
 
bool m_inhibit_notes_p
 
diagnostic_source_printing_options m_source_printing
 
enum diagnostics_column_unit m_column_unit
 
int m_column_origin
 
int m_tabstop
 

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 (diagnostic_t diag_kind)
 

Private Attributes

pretty_printerm_reference_printer
 
file_cachem_file_cache
 
diagnostic_counters m_diagnostic_counters
 
bool m_warning_as_error_requested
 
int m_n_opts
 
diagnostic_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
 
int m_max_errors
 
struct { 
 
   diagnostic_text_starter_fn   m_begin_diagnostic 
 
   diagnostic_start_span_fn   m_start_span 
 
   diagnostic_text_finalizer_fn   m_end_diagnostic 
 
m_text_callbacks 
 
diagnostic_option_managerm_option_mgr
 
unsigned m_lang_mask
 
urlifierm_urlifier
 
int m_lock
 
bool m_report_bug
 
enum diagnostics_extra_output_kind m_extra_output_kind
 
enum diagnostics_escape_format m_escape_format
 
edit_contextm_edit_context_ptr
 
struct { 
 
   int   m_group_nesting_depth 
 
   int   m_diagnostic_nesting_level 
 
   int   m_emission_count 
 
m_diagnostic_groups 
 
auto_vec< diagnostic_output_format * > m_output_sinks
 
set_locations_callback_t m_set_locations_cb
 
diagnostic_client_data_hooksm_client_data_hooks
 
struct { 
 
   text_art::theme *   m_theme 
 
m_diagrams 
 
char ** m_original_argv
 
diagnostic_bufferm_diagnostic_buffer
 

Friends

class diagnostic_source_print_policy
 
class diagnostic_text_output_format
 
class diagnostic_buffer
 
diagnostic_text_starter_fndiagnostic_text_starter (diagnostic_context *context)
 
diagnostic_start_span_fndiagnostic_start_span (diagnostic_context *context)
 
diagnostic_text_finalizer_fndiagnostic_text_finalizer (diagnostic_context *context)
 

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 diagnostic_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 diagnostic_output_format
  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 diagnostic_counters)
- calling out to a diagnostic_option_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
- an edit_context for generating patches from fix-it hints
- diagnostic_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

void(*) diagnostic_context::set_locations_callback_t(diagnostic_context *, diagnostic_info *)

Member Function Documentation

◆ action_after_output()

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

References 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, NULL, and real_abort().

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

◆ add_sink()

void diagnostic_context::add_sink ( std::unique_ptr< diagnostic_output_format > sink)

◆ begin_group()

◆ build_indent_prefix()

char * diagnostic_context::build_indent_prefix ( ) const

◆ check_max_errors()

void diagnostic_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 diagnostic_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()

diagnostic_t diagnostic_context::classify_diagnostic ( diagnostic_option_id option_id,
diagnostic_t new_kind,
location_t where )
inline

◆ clear_diagnostic_buffer()

void diagnostic_context::clear_diagnostic_buffer ( diagnostic_buffer & buffer)

◆ clone_printer()

std::unique_ptr< pretty_printer > diagnostic_context::clone_printer ( ) const
inline

◆ color_init()

void diagnostic_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_output_sinks, m_reference_printer, and pp_show_color().

Referenced by diagnostic_color_init().

◆ create_edit_context()

void diagnostic_context::create_edit_context ( )

References gcc_assert, m_edit_context_ptr, and m_file_cache.

Referenced by process_options().

◆ diagnostic_count() [1/2]

int & diagnostic_context::diagnostic_count ( diagnostic_t kind)
inline

◆ diagnostic_count() [2/2]

int diagnostic_context::diagnostic_count ( diagnostic_t kind) const
inline

◆ diagnostic_enabled()

bool diagnostic_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 DK_ANY, get_any_inlining_info(), diagnostic_option_classifier::get_current_override(), m_opt_permissive, m_option_classifier, option_enabled_p(), option_unspecified_p(), and diagnostic_option_classifier::update_effective_level_from_pragmas().

Referenced by report_diagnostic(), and warning_enabled_at().

◆ diagnostic_impl()

bool diagnostic_context::diagnostic_impl ( rich_location * richloc,
const diagnostic_metadata * metadata,
diagnostic_option_id option_id,
const char * gmsgid,
va_list * ap,
diagnostic_t kind )

◆ diagnostic_n_impl()

bool diagnostic_context::diagnostic_n_impl ( rich_location * richloc,
const diagnostic_metadata * metadata,
diagnostic_option_id option_id,
unsigned HOST_WIDE_INT n,
const char * singular_gmsgid,
const char * plural_gmsgid,
va_list * ap,
diagnostic_t kind )
Implement inform_n, warning_n, and error_n, as documented and
defined below.   

References ap, diagnostic_set_info_translated(), ngettext, report_diagnostic(), and ULONG_MAX.

Referenced by error_n(), inform_n(), warning_n(), and warning_n().

◆ dump() [1/2]

void DEBUG_FUNCTION diagnostic_context::dump ( ) const
inline

References dump().

Referenced by dump().

◆ dump() [2/2]

void diagnostic_context::dump ( FILE * out) const

◆ emit_diagnostic_with_group()

bool diagnostic_context::emit_diagnostic_with_group ( diagnostic_t kind,
rich_location & richloc,
const diagnostic_metadata * metadata,
diagnostic_option_id option_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 diagnostic_output_format_open_sarif_file(), and gcc::diagnostics_output_spec::context::open_output_file().

◆ emit_diagnostic_with_group_va()

bool diagnostic_context::emit_diagnostic_with_group_va ( diagnostic_t kind,
rich_location & richloc,
const diagnostic_metadata * metadata,
diagnostic_option_id option_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 diagnostic_context::emit_diagram ( const diagnostic_diagram & diagram)
Emit DIAGRAM to this context, respecting the output format.   

References m_diagrams, and m_output_sinks.

◆ end_group()

◆ error_recursion()

void diagnostic_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 diagnostic_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 toplev::main(), and sarif_invocation::prepare_to_flush().

◆ finish()

◆ flush_diagnostic_buffer()

void diagnostic_context::flush_diagnostic_buffer ( diagnostic_buffer & buffer)

◆ get_any_inlining_info()

void diagnostic_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_client_data_hooks()

◆ get_diagnostic_buffer()

diagnostic_buffer * diagnostic_context::get_diagnostic_buffer ( ) const
inline

References m_diagnostic_buffer.

◆ get_diagnostic_nesting_level()

bool bool int diagnostic_context::get_diagnostic_nesting_level ( ) const
inline

◆ get_diagram_theme()

text_art::theme * diagnostic_context::get_diagram_theme ( ) const
inline

◆ get_edit_context()

edit_context * diagnostic_context::get_edit_context ( ) const
inline

References m_edit_context_ptr.

Referenced by toplev::main().

◆ get_escape_format()

enum diagnostics_escape_format diagnostic_context::get_escape_format ( ) const
inline

◆ get_file_cache()

◆ get_lang_mask()

unsigned diagnostic_context::get_lang_mask ( ) const
inline

References m_lang_mask.

Referenced by init_asm_output().

◆ get_original_argv()

const char *const * diagnostic_context::get_original_argv ( )
inline

References m_original_argv.

◆ get_output_format()

diagnostic_output_format & diagnostic_context::get_output_format ( size_t idx) const

References gcc_assert, and m_output_sinks.

◆ get_path_format()

enum diagnostic_path_format diagnostic_context::get_path_format ( ) const
inline

References m_path_format.

◆ get_reference_printer()

◆ get_urlifier()

urlifier * diagnostic_context::get_urlifier ( ) const
inline

◆ initialize()

void diagnostic_context::initialize ( int n_opts)
Initialize the diagnostic message outputting machinery.   

References diagnostic_source_printing_options::caret_chars, diagnostic_counters::clear(), diagnostic_source_printing_options::colorize_source_p, default_diagnostic_start_span_fn(), default_diagnostic_text_finalizer(), default_diagnostic_text_starter(), diagnostic_set_caret_max_width(), DIAGNOSTICS_COLUMN_UNIT_DISPLAY, DIAGNOSTICS_ESCAPE_FORMAT_UNICODE, DIAGNOSTICS_TEXT_ART_CHARSET_ASCII, DIAGNOSTICS_TEXT_ART_CHARSET_EMOJI, DPF_NONE, diagnostic_source_printing_options::enabled, EXTRA_DIAGNOSTIC_OUTPUT_fixits_v1, EXTRA_DIAGNOSTIC_OUTPUT_fixits_v2, EXTRA_DIAGNOSTIC_OUTPUT_none, get_reference_printer(), i, diagnostic_option_classifier::init(), m_abort_on_error, m_adjust_diagnostic_info, m_client_aux_data, m_client_data_hooks, m_column_origin, m_column_unit, m_diagnostic_buffer, m_diagnostic_counters, m_diagnostic_groups, m_diagrams, m_edit_context_ptr, m_escape_format, m_extra_output_kind, m_fatal_errors, m_file_cache, m_inhibit_notes_p, m_inhibit_warnings, m_internal_error, m_last_location, m_lock, m_max_errors, m_n_opts, m_opt_permissive, m_option_classifier, m_option_mgr, m_original_argv, m_output_sinks, m_path_format, m_pedantic_errors, m_permissive, m_reference_printer, m_report_bug, m_set_locations_cb, m_show_column, m_show_cwe, m_show_option_requested, m_show_path_depths, m_show_rules, m_source_printing, m_tabstop, m_text_callbacks, m_urlifier, m_warn_system_headers, m_warning_as_error_requested, make_unique(), diagnostic_source_printing_options::min_margin_width, pp_line_cutoff(), set_text_art_charset(), diagnostic_source_printing_options::show_event_links_p, diagnostic_source_printing_options::show_labels_p, diagnostic_source_printing_options::show_line_numbers_p, diagnostic_source_printing_options::show_ruler_p, and UNKNOWN_LOCATION.

Referenced by diagnostic_initialize().

◆ initialize_input_context()

void diagnostic_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 file_cache::initialize_input_context(), and m_file_cache.

Referenced by diagnostic_initialize_input_context().

◆ make_option_name()

char * diagnostic_context::make_option_name ( diagnostic_option_id option_id,
diagnostic_t orig_diag_kind,
diagnostic_t diag_kind ) const
inline

◆ make_option_url()

char * diagnostic_context::make_option_url ( diagnostic_option_id option_id) const
inline

◆ maybe_show_locus()

void diagnostic_context::maybe_show_locus ( const rich_location & richloc,
diagnostic_t diagnostic_kind,
pretty_printer & pp,
diagnostic_source_effect_info * effects )
As per diagnostic_source_print_policy::print, but don't print anything
if source printing is disabled, or if the location hasn't changed.   

References BUILTINS_LOCATION, NULL, and diagnostic_source_print_policy::print().

Referenced by diagnostic_show_locus().

◆ option_enabled_p()

bool diagnostic_context::option_enabled_p ( diagnostic_option_id option_id) const
inline

◆ option_unspecified_p()

bool diagnostic_context::option_unspecified_p ( diagnostic_option_id option_id) const
inline

◆ override_urlifier()

void diagnostic_context::override_urlifier ( urlifier * urlifier)
Set the urlifier without deleting the existing one.   

References m_urlifier.

Referenced by auto_override_urlifier::auto_override_urlifier(), and auto_override_urlifier::~auto_override_urlifier().

◆ pch_restore()

int diagnostic_context::pch_restore ( FILE * f)
inline

◆ pch_save()

int diagnostic_context::pch_save ( FILE * f)
inline

◆ pop_diagnostics()

void diagnostic_context::pop_diagnostics ( location_t where)
inline

◆ pop_nesting_level()

void diagnostic_context::pop_nesting_level ( )

◆ push_diagnostics()

void diagnostic_context::push_diagnostics ( location_t where)
inline

◆ push_nesting_level()

void diagnostic_context::push_nesting_level ( )

◆ refresh_output_sinks()

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

References m_output_sinks.

Referenced by init_options_once(), and set_pretty_printer().

◆ report_diagnostic()

◆ report_verbatim()

void diagnostic_context::report_verbatim ( text_info & text)

References text_info::m_args_ptr, m_output_sinks, and va_copy.

Referenced by verbatim().

◆ set_client_data_hooks()

void diagnostic_context::set_client_data_hooks ( std::unique_ptr< diagnostic_client_data_hooks > hooks)

◆ set_diagnostic_buffer()

void diagnostic_context::set_diagnostic_buffer ( diagnostic_buffer * buffer)
If BUFFER is non-null, use BUFFER as the active diagnostic_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 diagnostic_buffer::ensure_per_format_buffers(), gcc_assert, m_diagnostic_buffer, m_diagnostic_groups, m_output_sinks, and diagnostic_buffer::m_per_format_buffers.

Referenced by finish().

◆ set_escape_format()

void diagnostic_context::set_escape_format ( enum diagnostics_escape_format val)
inline

◆ set_extra_output_kind()

void diagnostic_context::set_extra_output_kind ( enum diagnostics_extra_output_kind kind)
inline

References m_extra_output_kind.

Referenced by common_handle_option().

◆ set_format_decoder()

void diagnostic_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_output_sinks, m_reference_printer, and pp_format_decoder().

Referenced by tree_diagnostics_defaults().

◆ set_max_errors()

void diagnostic_context::set_max_errors ( int val)
inline

References m_max_errors.

Referenced by common_handle_option().

◆ set_option_manager()

void diagnostic_context::set_option_manager ( std::unique_ptr< diagnostic_option_manager > mgr,
unsigned lang_mask )

References m_lang_mask, and m_option_mgr.

Referenced by general_init(), and main().

◆ set_original_argv()

void diagnostic_context::set_original_argv ( unique_argv original_argv)

References m_original_argv, and unique_argv::release().

Referenced by general_init().

◆ set_output_format()

◆ set_path_format()

void diagnostic_context::set_path_format ( enum diagnostic_path_format val)
inline

◆ set_prefixing_rule()

void diagnostic_context::set_prefixing_rule ( diagnostic_prefixing_rule_t rule)

◆ set_pretty_printer()

void diagnostic_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 diagnostic_context::set_report_bug ( bool val)
inline

References m_report_bug.

Referenced by common_handle_option().

◆ set_set_locations_callback()

void diagnostic_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 diagnostic_context::set_show_cwe ( bool val)
inline

◆ set_show_highlight_colors()

◆ set_show_option_requested()

void diagnostic_context::set_show_option_requested ( bool val)
inline

◆ set_show_path_depths()

void diagnostic_context::set_show_path_depths ( bool val)
inline

References m_show_path_depths.

Referenced by common_handle_option(), and general_init().

◆ set_show_rules()

void diagnostic_context::set_show_rules ( bool val)
inline

◆ set_text_art_charset()

void diagnostic_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 NULL 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_urlifier()

void diagnostic_context::set_urlifier ( std::unique_ptr< urlifier > urlifier)

◆ set_warning_as_error_requested()

void diagnostic_context::set_warning_as_error_requested ( bool val)
inline

◆ show_path_depths_p()

bool diagnostic_context::show_path_depths_p ( ) const
inline

References m_show_path_depths.

◆ supports_fnotice_on_stderr_p()

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

References m_output_sinks.

Referenced by fnotice().

◆ urls_init()

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

References determine_url_format(), DIAGNOSTICS_URL_AUTO, pretty_printer::get_url_format(), m_output_sinks, m_reference_printer, and pretty_printer::set_url_format().

Referenced by diagnostic_urls_init().

◆ warning_as_error_requested_p()

bool diagnostic_context::warning_as_error_requested_p ( ) const
inline

◆ warning_enabled_at()

bool diagnostic_context::warning_enabled_at ( location_t loc,
diagnostic_option_id option_id )
Returns whether warning OPTION_ID is enabled at LOC.   

References diagnostic_enabled(), diagnostic_report_warnings_p, and line_table.

Referenced by warning_enabled_at().

Friends And Related Symbol Documentation

◆ diagnostic_buffer

friend class diagnostic_buffer
friend

◆ diagnostic_source_print_policy

friend class diagnostic_source_print_policy
friend

◆ diagnostic_start_span

diagnostic_start_span_fn & diagnostic_start_span ( diagnostic_context * context)
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.   

◆ diagnostic_text_finalizer

diagnostic_text_finalizer_fn & diagnostic_text_finalizer ( diagnostic_context * context)
friend
Client supplied function called after a diagnostic message is
displayed (for text-based diagnostic output).   

◆ diagnostic_text_output_format

friend class diagnostic_text_output_format
friend

◆ diagnostic_text_starter

diagnostic_text_starter_fn & diagnostic_text_starter ( diagnostic_context * context)
friend
Client supplied function to announce a diagnostic
(for text-based diagnostic output).   

Field Documentation

◆ m_abort_on_error

bool diagnostic_context::m_abort_on_error

◆ m_adjust_diagnostic_info

void(* diagnostic_context::m_adjust_diagnostic_info) (diagnostic_context *, diagnostic_info *)

Referenced by initialize(), and report_diagnostic().

◆ m_begin_diagnostic

diagnostic_text_starter_fn diagnostic_context::m_begin_diagnostic

◆ m_client_aux_data

void* diagnostic_context::m_client_aux_data

◆ m_client_data_hooks

diagnostic_client_data_hooks* diagnostic_context::m_client_data_hooks
private

◆ m_column_origin

int diagnostic_context::m_column_origin

Referenced by common_handle_option(), and initialize().

◆ m_column_unit

enum diagnostics_column_unit diagnostic_context::m_column_unit

◆ m_diagnostic_buffer

diagnostic_buffer* diagnostic_context::m_diagnostic_buffer
private

◆ m_diagnostic_counters

diagnostic_counters diagnostic_context::m_diagnostic_counters
private

◆ [struct]

◆ m_diagnostic_nesting_level

int diagnostic_context::m_diagnostic_nesting_level

◆ [struct]

struct { ... } diagnostic_context::m_diagrams

◆ m_edit_context_ptr

edit_context* diagnostic_context::m_edit_context_ptr
private

◆ m_emission_count

int diagnostic_context::m_emission_count

◆ m_end_diagnostic

diagnostic_text_finalizer_fn diagnostic_context::m_end_diagnostic

◆ m_escape_format

enum diagnostics_escape_format diagnostic_context::m_escape_format
private

◆ m_extra_output_kind

enum diagnostics_extra_output_kind diagnostic_context::m_extra_output_kind
private

◆ m_fatal_errors

bool diagnostic_context::m_fatal_errors

◆ m_file_cache

file_cache* diagnostic_context::m_file_cache
private

◆ m_group_nesting_depth

int diagnostic_context::m_group_nesting_depth

◆ m_inhibit_notes_p

◆ m_inhibit_warnings

bool diagnostic_context::m_inhibit_warnings

◆ m_internal_error

void(* diagnostic_context::m_internal_error) (diagnostic_context *, const char *, va_list *)

◆ m_lang_mask

unsigned diagnostic_context::m_lang_mask
private

◆ m_last_location

location_t diagnostic_context::m_last_location

◆ m_lock

int diagnostic_context::m_lock
private

◆ m_max_errors

int diagnostic_context::m_max_errors
private

◆ m_n_opts

int diagnostic_context::m_n_opts
private

Referenced by initialize().

◆ m_opt_permissive

int diagnostic_context::m_opt_permissive

◆ m_option_classifier

◆ m_option_mgr

◆ m_original_argv

char** diagnostic_context::m_original_argv
private

◆ m_output_sinks

◆ m_path_format

enum diagnostic_path_format diagnostic_context::m_path_format
private

◆ m_pedantic_errors

bool diagnostic_context::m_pedantic_errors

◆ m_permissive

bool diagnostic_context::m_permissive

Referenced by diagnostic_impl(), and initialize().

◆ m_reference_printer

◆ m_report_bug

bool diagnostic_context::m_report_bug
private

◆ m_set_locations_cb

set_locations_callback_t diagnostic_context::m_set_locations_cb
private

◆ m_show_column

◆ m_show_cwe

bool diagnostic_context::m_show_cwe
private

Referenced by initialize(), and set_show_cwe().

◆ m_show_option_requested

bool diagnostic_context::m_show_option_requested
private

◆ m_show_path_depths

bool diagnostic_context::m_show_path_depths
private

◆ m_show_rules

bool diagnostic_context::m_show_rules
private

Referenced by initialize(), and set_show_rules().

◆ m_source_printing

◆ m_start_span

diagnostic_start_span_fn diagnostic_context::m_start_span

◆ m_tabstop

int diagnostic_context::m_tabstop

◆ [struct]

struct { ... } diagnostic_context::m_text_callbacks

Referenced by initialize().

◆ m_theme

text_art::theme* diagnostic_context::m_theme

◆ m_urlifier

urlifier* diagnostic_context::m_urlifier
private

◆ m_warn_system_headers

bool diagnostic_context::m_warn_system_headers

◆ m_warning_as_error_requested

bool diagnostic_context::m_warning_as_error_requested
private

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