static void
diagnostic_output_format_init_json (diagnostic_context *context)
{
- /* Override callbacks. */
- context->m_print_path = nullptr; /* handled in json_end_diagnostic. */
+ /* Suppress normal textual path output. */
+ context->set_path_format (DPF_NONE);
/* The metadata is handled in JSON format, rather than as text. */
context->set_show_cwe (false);
static void
diagnostic_output_format_init_sarif (diagnostic_context *context)
{
+ /* Suppress normal textual path output. */
+ context->set_path_format (DPF_NONE);
+
/* Override callbacks. */
- context->m_print_path = nullptr; /* handled in sarif_end_diagnostic. */
context->set_ice_handler_callback (sarif_ice_handler);
/* The metadata is handled in SARIF format, rather than as text. */
} /* end of anonymous namespace for path-printing code. */
-/* Print PATH to CONTEXT, according to CONTEXT's path_format. */
+/* Print PATH according to this context's path_format. */
void
-default_tree_diagnostic_path_printer (diagnostic_context *context,
- const diagnostic_path *path)
+diagnostic_context::print_path (const diagnostic_path *path)
{
gcc_assert (path);
const unsigned num_events = path->num_events ();
- switch (context->get_path_format ())
+ switch (get_path_format ())
{
case DPF_NONE:
/* Do nothing. */
label_text event_text (event.get_desc (false));
gcc_assert (event_text.get ());
diagnostic_event_id_t event_id (i);
- if (context->show_path_depths_p ())
+ if (this->show_path_depths_p ())
{
int stack_depth = event.get_stack_depth ();
/* -fdiagnostics-path-format=separate-events doesn't print
{
/* Consolidate related events. */
path_summary summary (*path, true,
- context->m_source_printing.show_event_links_p);
- char *saved_prefix = pp_take_prefix (context->printer);
- pp_set_prefix (context->printer, NULL);
- print_path_summary_as_text (&summary, context,
- context->show_path_depths_p ());
- pp_flush (context->printer);
- pp_set_prefix (context->printer, saved_prefix);
+ m_source_printing.show_event_links_p);
+ char *saved_prefix = pp_take_prefix (this->printer);
+ pp_set_prefix (this->printer, NULL);
+ print_path_summary_as_text (&summary, this,
+ show_path_depths_p ());
+ pp_flush (this->printer);
+ pp_set_prefix (this->printer, saved_prefix);
}
break;
}
diagnostic_starter (context) = default_tree_diagnostic_starter;
diagnostic_finalizer (context) = default_diagnostic_finalizer;
diagnostic_format_decoder (context) = default_tree_printer;
- context->m_print_path = default_tree_diagnostic_path_printer;
context->set_set_locations_callback (set_inlining_locations);
context->set_client_data_hooks (make_compiler_data_hooks ());
}
bool default_tree_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool, bool *, const char **);
-extern void default_tree_diagnostic_path_printer (diagnostic_context *,
- const diagnostic_path *);
-
#endif /* ! GCC_TREE_DIAGNOSTIC_H */