GCC Middle and Back End API Reference
diagnostic_text_output_format Class Reference

#include <diagnostic-format-text.h>

Inheritance diagram for diagnostic_text_output_format:
Collaboration diagram for diagnostic_text_output_format:

Public Member Functions

 diagnostic_text_output_format (diagnostic_context &context)
 
 ~diagnostic_text_output_format ()
 
void on_begin_group () override
 
void on_end_group () override
 
void on_report_diagnostic (const diagnostic_info &, diagnostic_t orig_diag_kind) override
 
void on_diagram (const diagnostic_diagram &diagram) override
 
bool machine_readable_stderr_p () const final override
 

Protected Attributes

diagnostic_contextm_context
 

Private Member Functions

void print_any_cwe (const diagnostic_info &diagnostic)
 
void print_any_rules (const diagnostic_info &diagnostic)
 
void print_option_information (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind)
 

Detailed Description

Classic text-based output of diagnostics.
   Copyright (C) 2023-2024 Free Software Foundation, Inc.
   Contributed by David Malcolm <dmalcolm@redhat.com>.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Subclass of diagnostic_output_format for classic text-based output
to stderr.

Uses diagnostic_context.m_text_callbacks to provide client-specific
textual output (e.g. include paths, macro expansions, etc).   

Constructor & Destructor Documentation

◆ diagnostic_text_output_format()

diagnostic_text_output_format::diagnostic_text_output_format ( diagnostic_context & context)
inline

◆ ~diagnostic_text_output_format()

diagnostic_text_output_format::~diagnostic_text_output_format ( )

Member Function Documentation

◆ machine_readable_stderr_p()

bool diagnostic_text_output_format::machine_readable_stderr_p ( ) const
inlinefinaloverridevirtual

◆ on_begin_group()

void diagnostic_text_output_format::on_begin_group ( )
inlineoverridevirtual

◆ on_diagram()

◆ on_end_group()

void diagnostic_text_output_format::on_end_group ( )
inlineoverridevirtual

◆ on_report_diagnostic()

void diagnostic_text_output_format::on_report_diagnostic ( const diagnostic_info & diagnostic,
diagnostic_t orig_diag_kind )
overridevirtual

◆ print_any_cwe()

void diagnostic_text_output_format::print_any_cwe ( const diagnostic_info & diagnostic)
private
If DIAGNOSTIC has a CWE identifier, print it.

For example, if the diagnostic metadata associates it with CWE-119,
" [CWE-119]" will be printed, suitably colorized, and with a URL of a
description of the security issue.   

References colorize_start(), colorize_stop(), diagnostic_get_color_for_kind(), free(), diagnostic_metadata::get_cwe(), get_cwe_url(), diagnostic_info::kind, diagnostic_output_format::m_context, diagnostic_info::metadata, NULL, pp_begin_url(), pp_character(), pp_end_url(), pp_printf(), pp_set_prefix(), pp_show_color(), pp_string(), pp_take_prefix(), diagnostic_context::printer, and pretty_printer::supports_urls_p().

Referenced by on_report_diagnostic().

◆ print_any_rules()

void diagnostic_text_output_format::print_any_rules ( const diagnostic_info & diagnostic)
private

◆ print_option_information()

void diagnostic_text_output_format::print_option_information ( const diagnostic_info & diagnostic,
diagnostic_t orig_diag_kind )
private

Field Documentation

◆ m_context


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