-
- Downloads
diagnostics: avoid using diagnostic_context's m_printer [PR116613]
As work towards supporting multiple diagnostic outputs (where each
output has its own pretty_printer), avoid using diagnostic_context's
m_printer field. Instead, use the output format's printer. Currently
this *is* the dc's printer, but eventually it might not be.
No functional change intended.
gcc/ChangeLog:
PR other/116613
* diagnostic-format-json.cc (diagnostic_output_format_init_json):
Pass in the format. Use the format's printer when disabling
colorization. Move the call to set_output_format into here.
(diagnostic_output_format_init_json_stderr): Update for above
change.
(diagnostic_output_format_init_json_file): Likewise.
* diagnostic-format-sarif.cc
(diagnostic_output_format_init_sarif): Use the format's printer
when disabling colorization.
* diagnostic-path.cc (selftest::test_empty_path): Use the
text_output's printer.
(selftest::test_intraprocedural_path): Likewise.
(selftest::test_interprocedural_path_1): Likewise.
(selftest::test_interprocedural_path_2): Likewise.
(selftest::test_recursion): Likewise.
(selftest::test_control_flow_1): Likewise.
(selftest::test_control_flow_2): Likewise.
(selftest::test_control_flow_3): Likewise.
(selftest::assert_cfg_edge_path_streq): Likewise.
(selftest::test_control_flow_5): Likewise.
(selftest::test_control_flow_6): Likewise.
gcc/testsuite/ChangeLog:
PR other/116613
* gcc.dg/plugin/diagnostic_group_plugin.c
(test_output_format::on_begin_group): Use get_printer () rather
than accessing m_context.m_printer.
(test_output_format::on_end_group): Likewise.
* gcc.dg/plugin/diagnostic_plugin_xhtml_format.c
(xhtml_builder::m_printer): New field.
(xhtml_builder::xhtml_builder): Add "pp" param and use it to
initialize m_printer.
(xhtml_builder::on_report_diagnostic): Drop "context" param.
(xhtml_builder::make_element_for_diagnostic): Likewise. Use
this->m_printer rather than the context's m_printer. Pass
m_printer to call to diagnostic_show_locus.
(xhtml_builder::emit_diagram): Drop "context" param.
(xhtml_output_format::on_report_diagnostic): Drop context param
from call to m_builder.
(xhtml_output_format::on_diagram): Likewise.
(xhtml_output_format::xhtml_output_format): Pass result of
get_printer as printer for builder.
(diagnostic_output_format_init_xhtml): Use the fmt's printer
rather than the context's.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/diagnostic-format-json.cc 14 additions, 9 deletionsgcc/diagnostic-format-json.cc
- gcc/diagnostic-format-sarif.cc 1 addition, 1 deletiongcc/diagnostic-format-sarif.cc
- gcc/diagnostic-path.cc 19 additions, 19 deletionsgcc/diagnostic-path.cc
- gcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c 7 additions, 5 deletionsgcc/testsuite/gcc.dg/plugin/diagnostic_group_plugin.c
- gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.c 23 additions, 24 deletionsgcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.c
Loading
Please register or sign in to comment