GCC Middle and Back End API Reference
diagnostics::html_builder Class Reference
Collaboration diagram for diagnostics::html_builder:

Public Member Functions

 html_builder (context &dc, pretty_printer &pp, const line_maps *line_maps, const html_generation_options &html_gen_opts)
void dump (FILE *out, int indent) const
void set_main_input_filename (const char *name)
void on_report_diagnostic (const diagnostic_info &diagnostic, enum kind orig_diag_kind, html_sink_buffer *buffer)
void emit_diagram (const diagram &d)
void emit_global_graph (const lazily_created< digraphs::digraph > &)
void end_group ()
std::unique_ptr< xml::elementtake_current_diagnostic ()
void flush_to_file (FILE *outf)
const xml::documentget_document () const
void set_printer (pretty_printer &pp)
std::unique_ptr< xml::elementmake_element_for_metadata (const metadata &)
std::unique_ptr< xml::elementmake_element_for_patch (const diagnostic_info &diagnostic)
void add_focus_id (std::string focus_id)
std::unique_ptr< xml::nodemaybe_make_state_diagram (const paths::event &event)

Private Member Functions

void add_stylesheet (std::string url)
std::unique_ptr< xml::elementmake_element_for_diagnostic (const diagnostic_info &diagnostic, enum kind orig_diag_kind, bool alert)
std::unique_ptr< xml::elementmake_metadata_element (label_text label, label_text url)
void add_at_nesting_level (size_t nesting_level, std::unique_ptr< xml::element > child_diag_element)
void push_nesting_level ()
void pop_nesting_level ()
void add_graph (const digraphs::digraph &dg, xml::element &parent_element)

Private Attributes

contextm_context
pretty_printerm_printer
const line_maps * m_line_maps
html_generation_options m_html_gen_opts
const logical_locations::managerm_logical_loc_mgr
std::unique_ptr< xml::documentm_document
xml::elementm_head_element
xml::elementm_title_element
xml::elementm_body_element
xml::elementm_diagnostics_element
std::unique_ptr< xml::elementm_cur_diagnostic_element
std::vector< xml::element * > m_cur_nesting_levels
int m_next_diag_id
json::array m_ui_focus_ids
logical_locations::key m_last_logical_location
location_t m_last_location
expanded_location m_last_expanded_location

Friends

class html_sink_buffer

Detailed Description

A class for managing HTML output of diagnostics.

  Implemented:
  - message text

  Known limitations/missing functionality:
  - title for page
  - file/line/column
  - error vs warning
  - CWEs
  - rules
  - fix-it hints
  - paths

Constructor & Destructor Documentation

◆ html_builder()

diagnostics::html_builder::html_builder ( context & dc,
pretty_printer & pp,
const line_maps * line_maps,
const html_generation_options & html_gen_opts )

Member Function Documentation

◆ add_at_nesting_level()

void diagnostics::html_builder::add_at_nesting_level ( size_t nesting_level,
std::unique_ptr< xml::element > child_diag_element )
private

◆ add_focus_id()

void diagnostics::html_builder::add_focus_id ( std::string focus_id)
inline

References m_ui_focus_ids.

Referenced by make_element_for_diagnostic().

◆ add_graph()

◆ add_stylesheet()

void diagnostics::html_builder::add_stylesheet ( std::string url)
private

◆ dump()

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

◆ emit_diagram()

void diagnostics::html_builder::emit_diagram ( const diagram & d)
Implementation of diagnostics::context::m_diagrams.m_emission_cb
for HTML output.   

References gcc_assert, and m_cur_diagnostic_element.

◆ emit_global_graph()

void diagnostics::html_builder::emit_global_graph ( const lazily_created< digraphs::digraph > & ldg)

◆ end_group()

void diagnostics::html_builder::end_group ( )
Implementation of "end_group_cb" for HTML output.   

References m_cur_diagnostic_element, and m_diagnostics_element.

◆ flush_to_file()

void diagnostics::html_builder::flush_to_file ( FILE * outf)
Create a top-level object, and add it to all the results
(and other entities) we've seen so far.

Flush it all to OUTF.   

References xml::printer::add_raw(), DIAGNOSTICS_LOG_SCOPE_PRINTF0, gcc_assert, m_context, m_document, m_head_element, m_html_gen_opts, m_ui_focus_ids, xml::printer::pop_tag(), pp_formatted_text(), pp_string(), and xml::printer::push_tag().

◆ get_document()

const xml::document & diagnostics::html_builder::get_document ( ) const
inline

References m_document.

◆ make_element_for_diagnostic()

std::unique_ptr< xml::element > diagnostics::html_builder::make_element_for_diagnostic ( const diagnostic_info & diagnostic,
enum kind orig_diag_kind,
bool alert )
private
Make a <div class="gcc-diagnostic"> for DIAGNOSTIC.

If ALERT is true, make it be a PatternFly alert (see
https://pf3.patternfly.org/v3/pattern-library/widgets/#alerts) and
show severity text (e.g. "error: ").

If ALERT is false, don't show the severity text and don't show
the filename if it's the same as the previous diagnostic within the
diagnostic group.   

References _, add_focus_id(), add_graph(), diagnostics::add_labelled_value(), xml::printer::add_text(), xml::printer::add_text_from_pp(), xml::printer::append(), diagnostics::column_policy::converted_column(), diagnostic_expand_location(), gcc_assert, diagnostics::client_data_hooks::get_current_logical_location(), xml::printer::get_insertion_point(), diagnostics::get_label_for_logical_location_kind(), diagnostics::metadata::get_lazy_digraphs(), xml::printer::get_num_open_tags(), diagnostics::get_pf_class_for_alert_div(), diagnostics::get_pf_class_for_alert_icon(), diagnostics::get_text_for_kind(), m_context, m_last_expanded_location, m_last_location, m_last_logical_location, m_logical_loc_mgr, diagnostic::m_metadata, m_next_diag_id, m_printer, diagnostics::make_div(), make_element_for_metadata(), make_element_for_patch(), diagnostics::make_span(), path, xml::printer::pop_tag(), pp_clear_output_area(), pp_formatted_text(), pp_output_formatted_text(), pp_printf(), pp_printf_n(), diagnostics::print_path_as_html(), xml::printer::push_tag(), xml::printer::push_tag_with_class(), and xml::printer::set_attr().

Referenced by on_report_diagnostic().

◆ make_element_for_metadata()

◆ make_element_for_patch()

std::unique_ptr< xml::element > diagnostics::html_builder::make_element_for_patch ( const diagnostic_info & diagnostic)

◆ make_metadata_element()

std::unique_ptr< xml::element > diagnostics::html_builder::make_metadata_element ( label_text label,
label_text url )
private

◆ maybe_make_state_diagram()

◆ on_report_diagnostic()

void diagnostics::html_builder::on_report_diagnostic ( const diagnostic_info & diagnostic,
enum kind orig_diag_kind,
html_sink_buffer * buffer )

◆ pop_nesting_level()

void diagnostics::html_builder::pop_nesting_level ( )
private

◆ push_nesting_level()

void diagnostics::html_builder::push_nesting_level ( )
private

◆ set_main_input_filename()

void diagnostics::html_builder::set_main_input_filename ( const char * name)

References gcc_assert, and m_title_element.

◆ set_printer()

void diagnostics::html_builder::set_printer ( pretty_printer & pp)
inline

References m_printer.

◆ take_current_diagnostic()

std::unique_ptr< xml::element > diagnostics::html_builder::take_current_diagnostic ( )
inline

◆ html_sink_buffer

friend class html_sink_buffer
friend

References html_sink_buffer.

Referenced by html_sink_buffer, and on_report_diagnostic().

Field Documentation

◆ m_body_element

xml::element* diagnostics::html_builder::m_body_element
private

Referenced by emit_global_graph(), and html_builder().

◆ m_context

context& diagnostics::html_builder::m_context
private

◆ m_cur_diagnostic_element

std::unique_ptr<xml::element> diagnostics::html_builder::m_cur_diagnostic_element
private

◆ m_cur_nesting_levels

std::vector<xml::element *> diagnostics::html_builder::m_cur_nesting_levels
private

◆ m_diagnostics_element

xml::element* diagnostics::html_builder::m_diagnostics_element
private

Referenced by end_group(), and html_builder().

◆ m_document

std::unique_ptr<xml::document> diagnostics::html_builder::m_document
private

Referenced by flush_to_file(), and get_document().

◆ m_head_element

xml::element* diagnostics::html_builder::m_head_element
private

◆ m_html_gen_opts

html_generation_options diagnostics::html_builder::m_html_gen_opts
private

◆ m_last_expanded_location

expanded_location diagnostics::html_builder::m_last_expanded_location
private

◆ m_last_location

location_t diagnostics::html_builder::m_last_location
private

◆ m_last_logical_location

logical_locations::key diagnostics::html_builder::m_last_logical_location
private

◆ m_line_maps

const line_maps* diagnostics::html_builder::m_line_maps
private

Referenced by html_builder().

◆ m_logical_loc_mgr

const logical_locations::manager* diagnostics::html_builder::m_logical_loc_mgr
private

◆ m_next_diag_id

int diagnostics::html_builder::m_next_diag_id
private

◆ m_printer

pretty_printer* diagnostics::html_builder::m_printer
private

◆ m_title_element

xml::element* diagnostics::html_builder::m_title_element
private

◆ m_ui_focus_ids

json::array diagnostics::html_builder::m_ui_focus_ids
private

Referenced by add_focus_id(), and flush_to_file().


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