GCC Middle and Back End API Reference
|
#include <dump-context.h>
Data Structures | |
struct | custom_token_printer |
Public Member Functions | |
dump_pretty_printer (dump_context *context, dump_flags_t dump_kind) | |
void | set_optinfo (optinfo *info) |
virtual std::unique_ptr< pretty_printer > | clone () const |
void | set_output_stream (FILE *outfile) |
void | set_token_printer (token_printer *tp) |
void | set_prefix (char *prefix) |
void | emit_prefix () |
void | format (text_info &text) |
void | maybe_space () |
bool | supports_urls_p () const |
diagnostic_url_format | get_url_format () const |
void | set_url_format (diagnostic_url_format url_format) |
void | begin_url (const char *url) |
void | end_url () |
pp_wrapping_mode_t | set_verbatim_wrapping () |
void | set_padding (pp_padding padding) |
pp_padding | get_padding () const |
void | clear_state () |
void | set_real_maximum_length () |
int | remaining_character_count_for_line () |
void | dump (FILE *out, int indent) const |
void DEBUG_FUNCTION | dump () const |
Private Member Functions | |
bool | decode_format (text_info *text, const char *spec, pp_token_list &formatted_tok_list) |
void | stash_item (pp_token_list &formatted_tok_list, std::unique_ptr< optinfo_item > item) |
void | emit_item (std::unique_ptr< optinfo_item > item, optinfo *dest) |
Static Private Member Functions | |
static bool | format_decoder_cb (pretty_printer *pp, text_info *text, const char *spec, int, bool, bool, bool, bool @endverbatim *, pp_token_list &formatted_tok_list) |
A subclass of pretty_printer for implementing dump_context::dump_printf_va. In particular, the formatted chunks are captured as optinfo_item instances as pp_token_custom_data, thus retaining metadata about the entities being dumped (e.g. source locations), rather than just as plain text. These custom items are retained through to the end of stage 3 of formatted printing; the printer uses a custom token_printer subclass to emit them to the active optinfo (if any).
dump_pretty_printer::dump_pretty_printer | ( | dump_context * | context, |
dump_flags_t | dump_kind ) |
dump_pretty_printer's ctor.
References format_decoder_cb(), m_context, m_dump_kind, m_token_printer, pretty_printer::pp_format_decoder, pretty_printer::pretty_printer(), and pretty_printer::set_token_printer().
Referenced by dump_pretty_printer::custom_token_printer::custom_token_printer(), dump_pretty_printer::custom_token_printer::emit_any_pending_textual_chunks(), and format_decoder_cb().
|
inherited |
Support for encoding URLs. See egmontkob/Hyperlinks_in_Terminal_Emulators.md ( https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda ). > A hyperlink is opened upon encountering an OSC 8 escape sequence with > the target URI. The syntax is > > OSC 8 ; params ; URI ST > > A hyperlink is closed with the same escape sequence, omitting the > parameters and the URI but keeping the separators: > > OSC 8 ; ; ST > > OSC (operating system command) is typically ESC ]. Use BEL instead of ST, as that is currently rendered better in some terminal emulators that don't support OSC 8, like konsole.
If URL-printing is enabled, write an "open URL" escape sequence to PP for the given URL.
References gcc_unreachable, m_skipping_null_url, m_url_format, pp_string(), URL_FORMAT_BEL, URL_FORMAT_NONE, and URL_FORMAT_ST.
|
inlineinherited |
Clear this pretty_printer's output state.
References m_emitted_prefix, and pp_indentation.
Referenced by format(), pp_flush(), and pp_really_flush().
|
virtualinherited |
Base class implementation of pretty_printer::clone vfunc.
Referenced by element_event_desc::add_to_phase_2(), diagnostic_event::get_desc(), make_json_for_path(), and sarif_builder::make_location_object().
|
private |
Format decoder for dump_pretty_printer, and thus for dump_printf and dump_printf_loc. Supported format codes (in addition to the standard pretty_printer ones) are: %C: cgraph_node *: Equivalent to: dump_symtab_node (MSG_*, node) %E: gimple *: Equivalent to: dump_gimple_expr (MSG_*, TDF_SLIM, stmt, 0) %G: gimple *: Equivalent to: dump_gimple_stmt (MSG_*, TDF_SLIM, stmt, 0) %T: tree: Equivalent to: dump_generic_expr (MSG_*, arg, TDF_SLIM). TODO: add a format code that can handle (symtab_node*) *and* both subclasses (presumably means teaching -Wformat about non-virtual subclasses). These format codes build optinfo_item instances, thus capturing metadata about the arguments being dumped, as well as the textual output.
References text_info::m_args_ptr, make_item_for_dump_generic_expr(), make_item_for_dump_gimple_expr(), make_item_for_dump_gimple_stmt(), make_item_for_dump_symtab_node(), stash_item(), and TDF_SLIM.
Referenced by format_decoder_cb().
|
inlineinherited |
References DEBUG_FUNCTION, and dump().
Referenced by dump().
|
inherited |
Dump state of this pretty_printer to OUT, for debugging.
References gcc_unreachable, m_buffer, m_show_color, m_url_format, URL_FORMAT_BEL, URL_FORMAT_NONE, and URL_FORMAT_ST.
|
private |
Emit ITEM and take ownership of it. If DEST is non-NULL, add ITEM to DEST; otherwise delete ITEM.
References optinfo::add_item(), m_context, and m_dump_kind.
Referenced by dump_context::begin_scope(), dump_context::dump_dec(), dump_context::dump_symtab_node(), and dump_pretty_printer::custom_token_printer::emit_any_pending_textual_chunks().
|
inherited |
Write out this pretty_printer's prefix.
References DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE, DIAGNOSTICS_SHOW_PREFIX_NEVER, DIAGNOSTICS_SHOW_PREFIX_ONCE, m_emitted_prefix, m_prefix, pp_append_r(), pp_indent(), pp_indentation, and pp_prefixing_rule.
Referenced by pp_append_text().
|
inherited |
If URL-printing is enabled, write a "close URL" escape sequence to PP.
References get_end_url_string(), m_skipping_null_url, m_url_format, pp_string(), and URL_FORMAT_NONE.
|
inherited |
References clear_state(), format_phase_1(), format_phase_2(), pp_formatted_chunks::m_args, m_buffer, m_format_postprocessor, PP_NL_ARGMAX, pp_set_verbatim_wrapping(), and pp_wrapping_mode.
Referenced by dump_printf(), dump_printf_loc(), dump_context::dump_printf_loc_va(), and dump_context::dump_printf_va().
|
staticprivate |
pp_format_decoder callback for dump_pretty_printer, and thus for dump_printf and dump_printf_loc. A wrapper around decode_format, for type-safety.
References decode_format(), dump_pretty_printer(), and pretty_printer::pretty_printer().
Referenced by dump_pretty_printer().
|
inlineinherited |
References m_padding.
|
inlineinherited |
References m_url_format.
Referenced by get_end_url_string(), and diagnostic_text_output_format::update_printer().
|
inherited |
|
inherited |
Return the amount of characters PRETTY-PRINTER can accept to make a full line. Meaningful only in line-wrapping mode.
References output_buffer::m_line_length, m_maximum_length, and pp_buffer.
Referenced by pp_character(), and pp_wrap_text().
|
inline |
References m_token_printer.
Referenced by dump_context::dump_printf_va(), and opt_problem::opt_problem().
|
inlineinherited |
References m_buffer.
Referenced by dot_rdg_1(), ana::one_way_id_map< T >::dump(), digraph< GraphTraits >::dump_dot_to_file(), dump_insn_slim(), dump_rtl_slim(), dump_ssaname_info_to_file(), dump_value_slim(), gimple_dump_bb(), libgdiagnostics_path_event::make_desc(), print_gimple_expr(), print_gimple_seq(), print_gimple_stmt(), print_graph_cfg(), print_node(), start_graph_dump(), tree_dump_pretty_printer::tree_dump_pretty_printer(), and diagnostic_manager::write_patch().
|
inlineinherited |
References m_padding.
|
inherited |
Set PREFIX for PRETTY-PRINTER, taking ownership of PREFIX, which will eventually be free-ed.
References free(), m_emitted_prefix, m_prefix, pp_indentation, and set_real_maximum_length().
Referenced by lhd_print_error_function().
|
inherited |
Subroutine of pp_set_maximum_length. Set up PRETTY-PRINTER's internal maximum characters per line.
References DIAGNOSTICS_SHOW_PREFIX_NEVER, DIAGNOSTICS_SHOW_PREFIX_ONCE, m_maximum_length, m_prefix, pp_is_wrapping_line, pp_line_cutoff, and pp_prefixing_rule.
Referenced by pp_set_line_maximum_length(), and set_prefix().
|
inlineinherited |
References m_token_printer.
Referenced by dump_pretty_printer::dump_pretty_printer(), and sarif_output_format::update_printer().
|
inlineinherited |
References m_url_format.
|
inlineinherited |
References DIAGNOSTICS_SHOW_PREFIX_NEVER, pp_line_cutoff, pp_prefixing_rule, and pp_wrapping_mode.
|
private |
Append a custom pp_token for ITEM (generated in phase 2 of formatting) into FORMATTTED_TOK_LIST, so that it can be emitted in phase 2.
References gcc_assert, make_unique(), and pp_token_list::push_back().
Referenced by decode_format().
|
inlineinherited |
|
privateinherited |
Referenced by dump(), format(), pp_buffer, pp_buffer, pretty_printer(), pretty_printer(), set_output_stream(), and ~pretty_printer().
|
private |
Referenced by dump_pretty_printer(), and emit_item().
|
private |
Referenced by dump_pretty_printer(), and emit_item().
|
privateinherited |
Referenced by clear_state(), emit_prefix(), pretty_printer(), pretty_printer(), and set_prefix().
|
privateinherited |
Referenced by pp_format_decoder, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by format(), pp_format_postprocessor, pretty_printer(), pretty_printer(), and ~pretty_printer().
|
privateinherited |
Referenced by pp_indentation, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by pretty_printer(), pretty_printer(), remaining_character_count_for_line(), and set_real_maximum_length().
|
privateinherited |
Referenced by pp_needs_newline, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by get_padding(), maybe_space(), pretty_printer(), pretty_printer(), and set_padding().
|
privateinherited |
|
privateinherited |
Referenced by dump(), pp_show_color, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by pp_show_highlight_colors, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by begin_url(), end_url(), pretty_printer(), and pretty_printer().
|
private |
Referenced by dump_pretty_printer(), and set_optinfo().
|
privateinherited |
Referenced by pp_translate_identifiers, pretty_printer(), and pretty_printer().
|
privateinherited |
Referenced by begin_url(), dump(), end_url(), get_url_format(), pretty_printer(), pretty_printer(), set_url_format(), and supports_urls_p().
|
privateinherited |
Referenced by pp_line_cutoff, pp_prefixing_rule, pp_prefixing_rule, pp_wrapping_mode, pretty_printer(), and pretty_printer().