No functional change intended.
gcc/c-family/ChangeLog:
* c-opts.cc (c_diagnostic_text_finalizer): Add "m_" prefix to
fields of diagnostic_info.
gcc/c/ChangeLog:
* c-errors.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
gcc/cp/ChangeLog:
* constexpr.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
* error.cc: Likewise.
gcc/d/ChangeLog:
* d-diagnostic.cc (d_diagnostic_report_diagnostic): Update to add
"m_" prefix to fields of diagnostic_info throughout.
gcc/ChangeLog:
* diagnostic.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
* diagnostic.h: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* substring-locations.cc: Likewise.
* tree-diagnostic.cc: Likewise.
gcc/fortran/ChangeLog:
* error.cc: Update to add "m_" prefix to fields of
diagnostic_info throughout.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update to
add "m_" prefix to fields of diagnostic_info throughout.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
pp_newline (pp);
diagnostic_show_locus (&text_output.get_context (),
text_output.get_source_printing_options (),
- diagnostic->richloc, diagnostic->kind, pp);
+ diagnostic->m_richloc, diagnostic->m_kind, pp);
/* By default print macro expansion contexts in the diagnostic
finalizer -- for tokens resulting from macro expansion. */
diagnostics::virt_loc_aware_text_finalizer (text_output, diagnostic);
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(pedantic && !flag_isoc2y)
? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = OPT_Wc23_c2y_compat;
+ diagnostic.m_option_id = OPT_Wc23_c2y_compat;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
/* -Wno-c23-c2y-compat suppresses even the pedwarns. */
else if (pedantic && !flag_isoc2y)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
va_end (ap);
(pedantic && !flag_isoc23)
? DK_PEDWARN : DK_WARNING);
if (option_id == OPT_Wpedantic)
- diagnostic.option_id = OPT_Wc11_c23_compat;
+ diagnostic.m_option_id = OPT_Wc11_c23_compat;
else
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
/* -Wno-c11-c23-compat suppresses even the pedwarns. */
else if (pedantic && !flag_isoc23)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
va_end (ap);
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(pedantic && !flag_isoc11)
? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = OPT_Wc99_c11_compat;
+ diagnostic.m_option_id = OPT_Wc99_c11_compat;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
/* -Wno-c99-c11-compat suppresses even the pedwarns. */
else if (pedantic && !flag_isoc11)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
va_end (ap);
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(pedantic && !flag_isoc99)
? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
diagnostic_report_diagnostic (global_dc, &diagnostic);
warned = true;
goto out;
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(pedantic && !flag_isoc99)
? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = OPT_Wc90_c99_compat;
+ diagnostic.m_option_id = OPT_Wc90_c99_compat;
diagnostic_report_diagnostic (global_dc, &diagnostic);
}
/* -Wno-c90-c99-compat suppresses the pedwarns. */
else if (pedantic && !flag_isoc99)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc, DK_PEDWARN);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
diagnostic_report_diagnostic (global_dc, &diagnostic);
warned = true;
}
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
cxx_dialect < cxx23 ? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = OPT_Winvalid_constexpr;
+ diagnostic.m_option_id = OPT_Winvalid_constexpr;
ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
}
else
cp_adjust_diagnostic_info (diagnostic_context *context,
diagnostic_info *diagnostic)
{
- if (diagnostic->kind == DK_ERROR)
+ if (diagnostic->m_kind == DK_ERROR)
if (tree tmpl = get_current_template ())
{
- diagnostic->option_id = OPT_Wtemplate_body;
+ diagnostic->m_option_id = OPT_Wtemplate_body;
if (context->m_permissive)
- diagnostic->kind = DK_WARNING;
+ diagnostic->m_kind = DK_WARNING;
bool existed;
location_t &error_loc
/* Remember that this template had a parse-time error so
that we'll ensure a hard error has been issued upon
its instantiation. */
- error_loc = diagnostic->richloc->get_loc ();
+ error_loc = diagnostic->m_richloc->get_loc ();
}
}
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, &richloc,
(cxx_dialect == cxx98) ? DK_PEDWARN : DK_WARNING);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
ret = diagnostic_report_diagnostic (global_dc, &diagnostic);
va_end (ap);
return ret;
diagnostic_set_info_translated (&diagnostic, xformat, &argp,
&rich_loc, kind);
if (opt != 0)
- diagnostic.option_id = opt;
+ diagnostic.m_option_id = opt;
diagnostic_report_diagnostic (global_dc, &diagnostic);
}
diagnostic_t kind)
{
gcc_assert (richloc);
- diagnostic->message.m_err_no = errno;
- diagnostic->message.m_args_ptr = args;
- diagnostic->message.m_format_spec = msg;
- diagnostic->message.m_richloc = richloc;
- diagnostic->richloc = richloc;
- diagnostic->metadata = nullptr;
- diagnostic->kind = kind;
- diagnostic->option_id = 0;
+ diagnostic->m_message.m_err_no = errno;
+ diagnostic->m_message.m_args_ptr = args;
+ diagnostic->m_message.m_format_spec = msg;
+ diagnostic->m_message.m_richloc = richloc;
+ diagnostic->m_richloc = richloc;
+ diagnostic->m_metadata = nullptr;
+ diagnostic->m_kind = kind;
+ diagnostic->m_option_id = 0;
}
/* Initialize DIAGNOSTIC, where the message GMSGID has not yet been
diagnostic_option_id option = p->option;
/* The option 0 is for all the diagnostics. */
- if (option == 0 || option == diagnostic->option_id)
+ if (option == 0 || option == diagnostic->m_option_id)
{
diagnostic_t kind = p->kind;
if (kind != DK_UNSPECIFIED)
- diagnostic->kind = kind;
+ diagnostic->m_kind = kind;
return kind;
}
}
get_any_inlining_info (diagnostic);
/* Diagnostics with no option or -fpermissive are always enabled. */
- if (!diagnostic->option_id.m_idx
- || diagnostic->option_id == m_opt_permissive)
+ if (!diagnostic->m_option_id.m_idx
+ || diagnostic->m_option_id == m_opt_permissive)
return true;
/* This tests if the user provided the appropriate -Wfoo or
-Wno-foo option. */
- if (!option_enabled_p (diagnostic->option_id))
+ if (!option_enabled_p (diagnostic->m_option_id))
return false;
/* This tests for #pragma diagnostic changes. */
/* This tests if the user provided the appropriate -Werror=foo
option. */
if (diag_class == DK_UNSPECIFIED
- && !option_unspecified_p (diagnostic->option_id))
+ && !option_unspecified_p (diagnostic->m_option_id))
{
const diagnostic_t new_kind
- = m_option_classifier.get_current_override (diagnostic->option_id);
+ = m_option_classifier.get_current_override (diagnostic->m_option_id);
if (new_kind != DK_ANY)
/* DK_ANY means the diagnostic is not to be ignored, but we don't want
to change it specifically to DK_ERROR or DK_WARNING; we want to
preserve whatever the caller has specified. */
- diagnostic->kind = new_kind;
+ diagnostic->m_kind = new_kind;
}
/* This allows for future extensions, like temporarily disabling
warnings for ranges of source code. */
- if (diagnostic->kind == DK_IGNORED)
+ if (diagnostic->m_kind == DK_IGNORED)
return false;
return true;
rich_location richloc (line_table, loc);
diagnostic_info diagnostic = {};
- diagnostic.option_id = option_id;
- diagnostic.richloc = &richloc;
- diagnostic.message.m_richloc = &richloc;
- diagnostic.kind = DK_WARNING;
+ diagnostic.m_option_id = option_id;
+ diagnostic.m_richloc = &richloc;
+ diagnostic.m_message.m_richloc = &richloc;
+ diagnostic.m_kind = DK_WARNING;
return diagnostic_enabled (&diagnostic);
}
bool
diagnostic_context::report_diagnostic (diagnostic_info *diagnostic)
{
- diagnostic_t orig_diag_kind = diagnostic->kind;
+ diagnostic_t orig_diag_kind = diagnostic->m_kind;
/* Every call to report_diagnostic should be within a
begin_group/end_group pair so that output formats can reliably
/* Give preference to being able to inhibit warnings, before they
get reclassified to something else. */
- bool was_warning = (diagnostic->kind == DK_WARNING
- || diagnostic->kind == DK_PEDWARN);
+ bool was_warning = (diagnostic->m_kind == DK_WARNING
+ || diagnostic->m_kind == DK_PEDWARN);
if (was_warning && m_inhibit_warnings)
{
inhibit_notes_in_group ();
if (m_adjust_diagnostic_info)
m_adjust_diagnostic_info (this, diagnostic);
- if (diagnostic->kind == DK_PEDWARN)
+ if (diagnostic->m_kind == DK_PEDWARN)
{
- diagnostic->kind = m_pedantic_errors ? DK_ERROR : DK_WARNING;
+ diagnostic->m_kind = m_pedantic_errors ? DK_ERROR : DK_WARNING;
/* We do this to avoid giving the message for -pedantic-errors. */
- orig_diag_kind = diagnostic->kind;
+ orig_diag_kind = diagnostic->m_kind;
}
- if (diagnostic->kind == DK_NOTE && m_inhibit_notes_p)
+ if (diagnostic->m_kind == DK_NOTE && m_inhibit_notes_p)
return false;
/* If the user requested that warnings be treated as errors, so be
individual warnings can be overridden back to warnings with
-Wno-error=*. */
if (m_warning_as_error_requested
- && diagnostic->kind == DK_WARNING)
- diagnostic->kind = DK_ERROR;
+ && diagnostic->m_kind == DK_WARNING)
+ diagnostic->m_kind = DK_ERROR;
- diagnostic->message.m_data = &diagnostic->x_data;
+ diagnostic->m_message.m_data = &diagnostic->m_x_data;
/* Check to see if the diagnostic is enabled at the location and
not disabled by #pragma GCC diagnostic anywhere along the inlining
return false;
}
- if ((was_warning || diagnostic->kind == DK_WARNING)
+ if ((was_warning || diagnostic->m_kind == DK_WARNING)
&& ((!m_warn_system_headers
&& diagnostic->m_iinfo.m_allsyslocs)
|| m_inhibit_warnings))
inlining stack (if there is one) are in system headers. */
return false;
- if (diagnostic->kind == DK_NOTE && notes_inhibited_in_group ())
+ if (diagnostic->m_kind == DK_NOTE && notes_inhibited_in_group ())
/* Bail for all the notes in the diagnostic_group that started to inhibit notes. */
return false;
- if (diagnostic->kind != DK_NOTE && diagnostic->kind != DK_ICE)
+ if (diagnostic->m_kind != DK_NOTE && diagnostic->m_kind != DK_ICE)
check_max_errors (false);
if (m_lock > 0)
/* If we're reporting an ICE in the middle of some other error,
try to flush out the previous error, then let this one
through. Don't do this more than once. */
- if ((diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
+ if ((diagnostic->m_kind == DK_ICE || diagnostic->m_kind == DK_ICE_NOBT)
&& m_lock == 1)
pp_newline_and_flush (m_reference_printer);
else
m_lock++;
- if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
+ if (diagnostic->m_kind == DK_ICE || diagnostic->m_kind == DK_ICE_NOBT)
{
/* When not checking, ICEs are converted to fatal errors when an
error has already occurred. This is counteracted by
}
if (m_internal_error)
(*m_internal_error) (this,
- diagnostic->message.m_format_spec,
- diagnostic->message.m_args_ptr);
+ diagnostic->m_message.m_format_spec,
+ diagnostic->m_message.m_args_ptr);
}
/* Increment the counter for the appropriate diagnostic kind, either
within this context, or within the diagnostic_buffer. */
{
const diagnostic_t kind_for_count =
- ((diagnostic->kind == DK_ERROR && orig_diag_kind == DK_WARNING)
+ ((diagnostic->m_kind == DK_ERROR && orig_diag_kind == DK_WARNING)
? DK_WERROR
- : diagnostic->kind);
+ : diagnostic->m_kind);
diagnostic_counters &counters
= (m_diagnostic_buffer
? m_diagnostic_buffer->m_diagnostic_counters
sink_->on_begin_group ();
m_diagnostic_groups.m_emission_count++;
- va_list *orig_args = diagnostic->message.m_args_ptr;
+ va_list *orig_args = diagnostic->m_message.m_args_ptr;
for (auto sink_ : m_sinks)
{
/* Formatting the message is done per-output-format,
so that each has its own set to consume. */
va_list copied_args;
va_copy (copied_args, *orig_args);
- diagnostic->message.m_args_ptr = &copied_args;
- pp_format (sink_->get_printer (), &diagnostic->message);
+ diagnostic->m_message.m_args_ptr = &copied_args;
+ pp_format (sink_->get_printer (), &diagnostic->m_message);
va_end (copied_args);
/* Call vfunc in the output format. This is responsible for
break;
case EXTRA_DIAGNOSTIC_OUTPUT_fixits_v1:
print_parseable_fixits (get_file_cache (),
- m_reference_printer, diagnostic->richloc,
+ m_reference_printer, diagnostic->m_richloc,
DIAGNOSTICS_COLUMN_UNIT_BYTE,
m_tabstop);
pp_flush (m_reference_printer);
break;
case EXTRA_DIAGNOSTIC_OUTPUT_fixits_v2:
print_parseable_fixits (get_file_cache (),
- m_reference_printer, diagnostic->richloc,
+ m_reference_printer, diagnostic->m_richloc,
DIAGNOSTICS_COLUMN_UNIT_DISPLAY,
m_tabstop);
pp_flush (m_reference_printer);
break;
}
if (m_diagnostic_buffer == nullptr
- || diagnostic->kind == DK_ICE
- || diagnostic->kind == DK_ICE_NOBT)
- action_after_output (diagnostic->kind);
- diagnostic->x_data = nullptr;
+ || diagnostic->m_kind == DK_ICE
+ || diagnostic->m_kind == DK_ICE_NOBT)
+ action_after_output (diagnostic->m_kind);
+ diagnostic->m_x_data = nullptr;
if (m_edit_context_ptr)
- if (diagnostic->richloc->fixits_can_be_auto_applied_p ())
+ if (diagnostic->m_richloc->fixits_can_be_auto_applied_p ())
if (!m_diagnostic_buffer)
- m_edit_context_ptr->add_fixits (diagnostic->richloc);
+ m_edit_context_ptr->add_fixits (diagnostic->m_richloc);
m_lock--;
{
diagnostic_set_info (&diagnostic, gmsgid, ap, richloc,
m_permissive ? DK_WARNING : DK_ERROR);
- diagnostic.option_id = (option_id.m_idx != -1 ? option_id : m_opt_permissive);
+ diagnostic.m_option_id = (option_id.m_idx != -1 ? option_id : m_opt_permissive);
}
else
{
diagnostic_set_info (&diagnostic, gmsgid, ap, richloc, kind);
if (kind == DK_WARNING || kind == DK_PEDWARN)
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
}
- diagnostic.metadata = metadata;
+ diagnostic.m_metadata = metadata;
return report_diagnostic (&diagnostic);
}
const char *text = ngettext (singular_gmsgid, plural_gmsgid, gtn);
diagnostic_set_info_translated (&diagnostic, text, ap, richloc, kind);
if (kind == DK_WARNING)
- diagnostic.option_id = option_id;
- diagnostic.metadata = metadata;
+ diagnostic.m_option_id = option_id;
+ diagnostic.m_metadata = metadata;
return report_diagnostic (&diagnostic);
}
struct diagnostic_info
{
diagnostic_info ()
- : message (), richloc (), metadata (), x_data (), kind (), option_id (),
- m_iinfo ()
+ : m_message (),
+ m_richloc (),
+ m_metadata (),
+ m_x_data (),
+ m_kind (),
+ m_option_id (),
+ m_iinfo ()
{ }
/* Text to be formatted. */
- text_info message;
+ text_info m_message;
/* The location at which the diagnostic is to be reported. */
- rich_location *richloc;
+ rich_location *m_richloc;
/* An optional bundle of metadata associated with the diagnostic
(or NULL). */
- const diagnostics::metadata *metadata;
+ const diagnostics::metadata *m_metadata;
/* Auxiliary data for client. */
- void *x_data;
+ void *m_x_data;
/* The kind of diagnostic it is about. */
- diagnostic_t kind;
+ diagnostic_t m_kind;
/* Which OPT_* directly controls this diagnostic. */
- diagnostic_option_id option_id;
+ diagnostic_option_id m_option_id;
/* Inlining context containing locations for each call site along
the inlining stack. */
/* Extension hooks for client. */
#define diagnostic_context_auxiliary_data(DC) (DC)->m_client_aux_data
-#define diagnostic_info_auxiliary_data(DI) (DI)->x_data
+#define diagnostic_info_auxiliary_data(DI) (DI)->m_x_data
/* This diagnostic_context is used by front-ends that directly output
diagnostic messages without going through `error', `warning',
diagnostic_set_option_id (diagnostic_info *info,
diagnostic_option_id option_id)
{
- info->option_id = option_id;
+ info->m_option_id = option_id;
}
/* Diagnostic related functions. */
inline location_t
diagnostic_location (const diagnostic_info * diagnostic, int which = 0)
{
- return diagnostic->message.get_location (which);
+ return diagnostic->m_message.get_location (which);
}
/* Return the number of locations to be printed in DIAGNOSTIC. */
inline unsigned int
diagnostic_num_locations (const diagnostic_info * diagnostic)
{
- return diagnostic->message.m_richloc->get_num_locations ();
+ return diagnostic->m_message.m_richloc->get_num_locations ();
}
/* Expand the location of this diagnostic. Use this function for
inline expanded_location
diagnostic_expand_location (const diagnostic_info * diagnostic, int which = 0)
{
- return diagnostic->richloc->get_expanded_location (which);
+ return diagnostic->m_richloc->get_expanded_location (which);
}
/* This is somehow the right-side margin of a caret line, that is, we
diagnostic_t orig_diag_kind,
html_sink_buffer *buffer)
{
- if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT)
+ if (diagnostic.m_kind == DK_ICE || diagnostic.m_kind == DK_ICE_NOBT)
{
/* Print a header for the remaining output to stderr, and
return, attempting to print the usual ICE messages to
diag_element->set_attr ("id", diag_id);
if (alert)
diag_element->set_attr ("class",
- get_pf_class_for_alert_div (diagnostic.kind));
+ get_pf_class_for_alert_div (diagnostic.m_kind));
xml::printer xp (*diag_element.get ());
const size_t depth_within_alert_div = 1;
if (alert)
{
xp.push_tag_with_class ("span",
- get_pf_class_for_alert_icon (diagnostic.kind),
+ get_pf_class_for_alert_icon (diagnostic.m_kind),
true);
xp.add_text (" ");
xp.pop_tag ("span");
if (show_severity)
{
xp.push_tag ("strong");
- xp.add_text (_(get_diagnostic_kind_text (diagnostic.kind)));
+ xp.add_text (_(get_diagnostic_kind_text (diagnostic.m_kind)));
xp.pop_tag ("strong");
xp.add_text (" ");
}
pp_clear_output_area (m_printer);
// Add any metadata as a suffix to the message
- if (diagnostic.metadata)
+ if (diagnostic.m_metadata)
{
xp.add_text (" ");
- xp.append (make_element_for_metadata (*diagnostic.metadata));
+ xp.append (make_element_for_metadata (*diagnostic.m_metadata));
}
// Add any option as a suffix to the message
label_text option_text = label_text::take
- (m_context.make_option_name (diagnostic.option_id,
- orig_diag_kind, diagnostic.kind));
+ (m_context.make_option_name (diagnostic.m_option_id,
+ orig_diag_kind, diagnostic.m_kind));
if (option_text.get ())
{
label_text option_url = label_text::take
- (m_context.make_option_url (diagnostic.option_id));
+ (m_context.make_option_url (diagnostic.m_option_id));
xp.add_text (" ");
auto option_span = make_span ("gcc-option");
// TODO: m_context.m_last_location should be moved into the sink
location_t saved = m_context.m_last_location;
m_context.m_last_location = m_last_location;
- m_context.maybe_show_locus_as_html (*diagnostic.richloc,
+ m_context.maybe_show_locus_as_html (*diagnostic.m_richloc,
m_context.m_source_printing,
- diagnostic.kind,
+ diagnostic.m_kind,
xp,
nullptr,
nullptr);
gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
/* Execution path. */
- if (auto path = diagnostic.richloc->get_path ())
+ if (auto path = diagnostic.m_richloc->get_path ())
{
xp.push_tag ("div");
xp.set_attr ("id", "execution-path");
gcc_assert (xp.get_num_open_tags () == depth_within_alert_div);
// Try to display any per-diagnostic graphs
- if (diagnostic.metadata)
- if (auto ldg = diagnostic.metadata->get_lazy_digraphs ())
+ if (diagnostic.m_metadata)
+ if (auto ldg = diagnostic.m_metadata->get_lazy_digraphs ())
{
auto &digraphs = ldg->get_or_create_digraphs ();
for (auto &dg : digraphs)
html_builder::make_element_for_patch (const diagnostic_info &diagnostic)
{
edit_context ec (m_context.get_file_cache ());
- ec.add_fixits (diagnostic.richloc);
+ ec.add_fixits (diagnostic.m_richloc);
if (char *diff = ec.generate_diff (true))
{
if (strlen (diff) > 0)
sometimes these will related to current_function_decl, but
often they won't. */
auto location_obj
- = builder.make_location_object (this, *diagnostic.richloc,
+ = builder.make_location_object (this, *diagnostic.m_richloc,
logical_locations::key (),
diagnostic_artifact_role::result_file);
auto message_obj
{
pp_output_formatted_text (m_printer, m_context.get_urlifier ());
- if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT)
+ if (diagnostic.m_kind == DK_ICE || diagnostic.m_kind == DK_ICE_NOBT)
{
std::unique_ptr<json::object> stack = make_stack_from_backtrace ();
m_invocation_obj->add_notification_for_ice (diagnostic, *this,
/* "ruleId" property (SARIF v2.1.0 section 3.27.5). */
/* Ideally we'd have an option_name for these. */
if (char *option_text
- = m_context.make_option_name (diagnostic.option_id,
- orig_diag_kind, diagnostic.kind))
+ = m_context.make_option_name (diagnostic.m_option_id,
+ orig_diag_kind, diagnostic.m_kind))
{
/* Lazily create reportingDescriptor objects for and add to m_rules_arr.
Set ruleId referencing them. */
free (rule_id);
}
- if (diagnostic.metadata)
+ if (diagnostic.m_metadata)
{
/* "taxa" property (SARIF v2.1.0 section 3.27.8). */
- if (int cwe_id = diagnostic.metadata->get_cwe ())
+ if (int cwe_id = diagnostic.m_metadata->get_cwe ())
{
auto taxa_arr = std::make_unique<json::array> ();
taxa_arr->append<sarif_reporting_descriptor_reference>
result_obj->set<json::array> ("taxa", std::move (taxa_arr));
}
- diagnostic.metadata->maybe_add_sarif_properties (*result_obj);
+ diagnostic.m_metadata->maybe_add_sarif_properties (*result_obj);
/* We don't yet support diagnostics::metadata::rule. */
}
/* "level" property (SARIF v2.1.0 section 3.27.10). */
- if (const char *sarif_level = maybe_get_sarif_level (diagnostic.kind))
+ if (const char *sarif_level = maybe_get_sarif_level (diagnostic.m_kind))
result_obj->set_string ("level", sarif_level);
/* "message" property (SARIF v2.1.0 section 3.27.11). */
diagnostic_artifact_role::result_file));
/* "codeFlows" property (SARIF v2.1.0 section 3.27.18). */
- if (const paths::path *path = diagnostic.richloc->get_path ())
+ if (const paths::path *path = diagnostic.m_richloc->get_path ())
{
auto code_flows_arr = std::make_unique<json::array> ();
const unsigned code_flow_index = 0;
}
// "graphs" property (SARIF v2.1.0 section 3.27.19). */
- if (diagnostic.metadata)
- if (auto ldg = diagnostic.metadata->get_lazy_digraphs ())
+ if (diagnostic.m_metadata)
+ if (auto ldg = diagnostic.m_metadata->get_lazy_digraphs ())
{
auto &digraphs = ldg->get_or_create_digraphs ();
auto graphs_arr = std::make_unique<json::array> ();
group. */
/* "fixes" property (SARIF v2.1.0 section 3.27.30). */
- const rich_location *richloc = diagnostic.richloc;
+ const rich_location *richloc = diagnostic.m_richloc;
if (richloc->get_num_fixit_hints ())
{
auto fix_arr = std::make_unique<json::array> ();
it seems redundant compared to "id". */
/* "helpUri" property (SARIF v2.1.0 section 3.49.12). */
- if (char *option_url = m_context.make_option_url (diagnostic.option_id))
+ if (char *option_url = m_context.make_option_url (diagnostic.m_option_id))
{
reporting_desc->set_string ("helpUri", option_url);
free (option_url);
logical_loc = client_data_hooks->get_current_logical_location ();
auto location_obj
- = make_location_object (&loc_mgr, *diagnostic.richloc, logical_loc, role);
+ = make_location_object (&loc_mgr, *diagnostic.m_richloc, logical_loc, role);
/* Don't add entirely empty location objects to the array. */
if (!location_obj->is_empty ())
locations_arr->append<sarif_location> (std::move (location_obj));
text_sink::
after_diagnostic (const diagnostic_info &diagnostic)
{
- if (const paths::path *path = diagnostic.richloc->get_path ())
+ if (const paths::path *path = diagnostic.m_richloc->get_path ())
print_path (*path);
}
char *
text_sink::build_prefix (const diagnostic_info &diagnostic) const
{
- gcc_assert (diagnostic.kind < DK_LAST_DIAGNOSTIC_KIND);
+ gcc_assert (diagnostic.m_kind < DK_LAST_DIAGNOSTIC_KIND);
- const char *text = _(get_diagnostic_kind_text (diagnostic.kind));
+ const char *text = _(get_diagnostic_kind_text (diagnostic.m_kind));
const char *text_cs = "", *text_ce = "";
pretty_printer *pp = get_printer ();
- if (const char *color_name = diagnostic_get_color_for_kind (diagnostic.kind))
+ if (const char *color_name = diagnostic_get_color_for_kind (diagnostic.m_kind))
{
text_cs = colorize_start (pp_show_color (pp), color_name);
text_ce = colorize_stop (pp_show_color (pp));
/* Reduce verbosity of nested diagnostics by not printing "note: "
all the time. */
- if (diagnostic.kind == DK_NOTE)
+ if (diagnostic.m_kind == DK_NOTE)
return indent_prefix;
char *result = build_message_string ("%s%s%s%s", indent_prefix,
pretty_printer *pp = get_printer ();
char *saved_prefix = pp_take_prefix (pp);
pp_set_prefix (pp, build_prefix (diagnostic));
- pp_format (pp, &diagnostic.message);
+ pp_format (pp, &diagnostic.m_message);
pp_output_formatted_text (pp);
pp_destroy_prefix (pp);
pp_set_prefix (pp, saved_prefix);
void
text_sink::print_any_cwe (const diagnostic_info &diagnostic)
{
- if (!diagnostic.metadata)
+ if (!diagnostic.m_metadata)
return;
- int cwe = diagnostic.metadata->get_cwe ();
+ int cwe = diagnostic.m_metadata->get_cwe ();
if (cwe)
{
pretty_printer * const pp = get_printer ();
char *saved_prefix = pp_take_prefix (pp);
pp_string (pp, " [");
- const char *kind_color = diagnostic_get_color_for_kind (diagnostic.kind);
+ const char *kind_color = diagnostic_get_color_for_kind (diagnostic.m_kind);
pp_string (pp, colorize_start (pp_show_color (pp), kind_color));
if (pp->supports_urls_p ())
{
void
text_sink::print_any_rules (const diagnostic_info &diagnostic)
{
- if (!diagnostic.metadata)
+ if (!diagnostic.m_metadata)
return;
- for (unsigned idx = 0; idx < diagnostic.metadata->get_num_rules (); idx++)
+ for (unsigned idx = 0; idx < diagnostic.m_metadata->get_num_rules (); idx++)
{
const diagnostics::metadata::rule &rule
- = diagnostic.metadata->get_rule (idx);
+ = diagnostic.m_metadata->get_rule (idx);
if (char *desc = rule.make_description ())
{
pretty_printer * const pp = get_printer ();
char *saved_prefix = pp_take_prefix (pp);
pp_string (pp, " [");
const char *kind_color
- = diagnostic_get_color_for_kind (diagnostic.kind);
+ = diagnostic_get_color_for_kind (diagnostic.m_kind);
pp_string (pp, colorize_start (pp_show_color (pp), kind_color));
char *url = nullptr;
if (pp->supports_urls_p ())
diagnostic_t orig_diag_kind)
{
if (char *option_text
- = m_context.make_option_name (diagnostic.option_id,
- orig_diag_kind, diagnostic.kind))
+ = m_context.make_option_name (diagnostic.m_option_id,
+ orig_diag_kind, diagnostic.m_kind))
{
char *option_url = nullptr;
pretty_printer * const pp = get_printer ();
if (pp->supports_urls_p ())
- option_url = m_context.make_option_url (diagnostic.option_id);
+ option_url = m_context.make_option_url (diagnostic.m_option_id);
pp_string (pp, " [");
- const char *kind_color = diagnostic_get_color_for_kind (diagnostic.kind);
+ const char *kind_color = diagnostic_get_color_for_kind (diagnostic.m_kind);
pp_string (pp, colorize_start (pp_show_color (pp), kind_color));
if (option_url)
pp_begin_url (pp, option_url);
pp_newline (pp);
diagnostic_show_locus (&text_output.get_context (),
text_output.get_source_printing_options (),
- diagnostic->richloc, diagnostic->kind, pp);
+ diagnostic->m_richloc, diagnostic->m_kind, pp);
pp_set_prefix (pp, saved_prefix);
pp_flush (pp);
}
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
DK_WARNING);
- diagnostic.option_id = opt;
+ diagnostic.m_option_id = opt;
bool ret = gfc_report_diagnostic (&diagnostic);
if (buffered_p)
const char *color
= (loc_num
? "range1"
- : diagnostic_get_color_for_kind (curr_diagnostic->kind));
+ : diagnostic_get_color_for_kind (curr_diagnostic->m_kind));
pp_string (pp, colorize_start (pp_show_color (pp), color));
pp_string (pp, result[loc_num]);
pp_string (pp, colorize_stop (pp_show_color (pp)));
#undef DEFINE_DIAGNOSTIC_KIND
NULL
};
- gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
- const char *text = _(diagnostic_kind_text[diagnostic->kind]);
+ gcc_assert (diagnostic->m_kind < DK_LAST_DIAGNOSTIC_KIND);
+ const char *text = _(diagnostic_kind_text[diagnostic->m_kind]);
const char *text_cs = "", *text_ce = "";
pretty_printer *const pp = context->get_reference_printer ();
- if (diagnostic_kind_color[diagnostic->kind])
+ if (diagnostic_kind_color[diagnostic->m_kind])
{
text_cs = colorize_start (pp_show_color (pp),
- diagnostic_kind_color[diagnostic->kind]);
+ diagnostic_kind_color[diagnostic->m_kind]);
text_ce = colorize_stop (pp_show_color (pp));
}
return build_message_string ("%s%s:%s ", text_cs, text, text_ce);
expanded_location s1 = diagnostic_expand_location (diagnostic);
expanded_location s2;
- bool one_locus = diagnostic->richloc->get_num_locations () < 2;
+ bool one_locus = diagnostic->m_richloc->get_num_locations () < 2;
bool same_locus = false;
if (!one_locus)
pp_newline (pp);
diagnostic_show_locus (context,
text_output.get_source_printing_options (),
- diagnostic->richloc, diagnostic->kind,
+ diagnostic->m_richloc, diagnostic->m_kind,
pp);
/* If the caret line was shown, the prefix does not contain the
locus. */
va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_WARNING);
- diagnostic.option_id = opt;
+ diagnostic.m_option_id = opt;
ret = gfc_report_diagnostic (&diagnostic);
va_end (argp);
return ret;
va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
DK_WARNING);
- diagnostic.option_id = opt;
+ diagnostic.m_option_id = opt;
ret = gfc_report_diagnostic (&diagnostic);
va_end (argp);
return ret;
va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc,
DK_WARNING);
- diagnostic.option_id = opt;
+ diagnostic.m_option_id = opt;
ret = gfc_report_diagnostic (&diagnostic);
va_end (argp);
return ret;
diagnostic_text_sink::text_starter (diagnostics::text_sink &text_output,
const diagnostic_info *info)
{
- gcc_assert (info->x_data);
- const diagnostic &diag = *static_cast<const diagnostic *> (info->x_data);
+ gcc_assert (info->m_x_data);
+ const diagnostic &diag = *static_cast<const diagnostic *> (info->m_x_data);
pretty_printer *pp = text_output.get_printer ();
const diagnostic_logical_location *diag_logical_loc
= diag.get_logical_location ();
diagnostic_set_info (&info, msgid, args, diag.get_rich_location (),
diagnostic_t_from_diagnostic_level (diag.get_level ()));
GCC_DIAGNOSTIC_POP
- info.metadata = diag.get_metadata ();
- info.x_data = &diag;
+ info.m_metadata = diag.get_metadata ();
+ info.m_x_data = &diag;
diagnostic_report_diagnostic (&m_dc, &info);
m_dc.end_group ();
else
diagnostic_set_info (&diagnostic, singular_gmsgid, ap, &richloc,
DK_WARNING);
- diagnostic.option_id = option_id;
+ diagnostic.m_option_id = option_id;
bool warned = diagnostic_report_diagnostic (global_dc, &diagnostic);
if (!err && fmt_substring_loc && !substring_within_range)
pp_newline (pp);
diagnostic_show_locus (&text_output.get_context (),
text_output.get_source_printing_options (),
- diagnostic->richloc, diagnostic->kind, pp);
+ diagnostic->m_richloc, diagnostic->m_kind, pp);
pp_show_color (pp) = old_show_color;
pp_set_prefix (pp, saved_prefix);
pp_flush (pp);
/* Set if all locations are in a system header. */
diagnostic->m_iinfo.m_allsyslocs = nsyslocs == ilocs.length ();
- if (tree *ao = pp_ti_abstract_origin (&diagnostic->message))
+ if (tree *ao = pp_ti_abstract_origin (&diagnostic->m_message))
*ao = (tree)diagnostic->m_iinfo.m_ao;
}