mirror of git://gcc.gnu.org/git/gcc.git
diagnostics: use const and references for diagnostic_info
No functional change intended.
gcc/c-family/ChangeLog:
* c-opts.cc (c_diagnostic_finalizer): Make "diagnostic" param
const.
gcc/cp/ChangeLog:
* cp-tree.h (cxx_print_error_function): Make diagnostic_info param
const.
* error.cc (cxx_print_error_function): Likewise.
(cp_diagnostic_starter): Likewise.
(cp_print_error_function): Likewise.
gcc/ChangeLog:
* diagnostic-format-json.cc (on_begin_diagnostic): Convert param
to const reference.
(on_end_diagnostic): Likewise.
(json_output_format::on_end_diagnostic): Likewise.
* diagnostic-format-sarif.cc
(sarif_invocation::add_notification_for_ice): Likewise.
(sarif_result::on_nested_diagnostic): Likewise.
(sarif_ice_notification::sarif_ice_notification): Likewise.
(sarif_builder::end_diagnostic): Likewise.
(sarif_builder::make_result_object): Likewise.
(make_reporting_descriptor_object_for_warning): Likewise.
(sarif_builder::make_locations_arr): Likewise.
(sarif_output_format::on_begin_diagnostic): Likewise.
(sarif_output_format::on_end_diagnostic): Likewise.
* diagnostic.cc (default_diagnostic_starter): Make diagnostic_info
param const.
(default_diagnostic_finalizer): Likewise.
(diagnostic_context::report_diagnostic): Pass diagnostic by
reference to on_{begin,end}_diagnostic.
(diagnostic_text_output_format::on_begin_diagnostic): Convert
param to const reference.
(diagnostic_text_output_format::on_end_diagnostic): Likewise.
* diagnostic.h (diagnostic_starter_fn): Make diagnostic_info param
const.
(diagnostic_finalizer_fn): Likeewise.
(diagnostic_output_format::on_begin_diagnostic): Convert param to
const reference.
(diagnostic_output_format::on_end_diagnostic): Likewise.
(diagnostic_text_output_format::on_begin_diagnostic): Likewise.
(diagnostic_text_output_format::on_end_diagnostic): Likewise.
(default_diagnostic_starter): Make diagnostic_info param const.
(default_diagnostic_finalizer): Likewise.
* langhooks-def.h (lhd_print_error_function): Make diagnostic_info
param const.
* langhooks.cc (lhd_print_error_function): Likewise.
* langhooks.h (lang_hooks::print_error_function): Likewise.
* tree-diagnostic.cc (diagnostic_report_current_function):
Likewise.
(default_tree_diagnostic_starter): Likewise.
(virt_loc_aware_diagnostic_finalizer): Likewise.
* tree-diagnostic.h (diagnostic_report_current_function):
Likewise.
(virt_loc_aware_diagnostic_finalizer): Likewise.
gcc/fortran/ChangeLog:
* error.cc (gfc_diagnostic_starter): Make diagnostic_info param
const.
(gfc_diagnostic_finalizer): Likewise.
gcc/jit/ChangeLog:
* dummy-frontend.cc (jit_begin_diagnostic): Make diagnostic_info
param const.
(jit_end_diagnostic): Likewise. Pass to add_diagnostic by
reference.
* jit-playback.cc (jit::playback::context::add_diagnostic):
Convert diagnostic_info to const reference.
* jit-playback.h (jit::playback::context::add_diagnostic):
Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/show_template_tree_color_plugin.c
(noop_starter_fn): Make diagnostic_info param const.
* gcc.dg/plugin/diagnostic_group_plugin.c
(test_diagnostic_starter): Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(custom_diagnostic_finalizer): Likewise.
* gcc.dg/plugin/location_overflow_plugin.c
(verify_unpacked_ranges): Likewise.
(verify_no_columns): Likewise.
libcc1/ChangeLog:
* context.cc (plugin_print_error_function): Make diagnostic_info
param const.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
parent
e7d6c277fa
commit
8fc4e6c397
|
|
@ -168,7 +168,7 @@ c_common_option_lang_mask (void)
|
|||
/* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */
|
||||
static void
|
||||
c_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t)
|
||||
{
|
||||
char *saved_prefix = pp_take_prefix (context->printer);
|
||||
|
|
|
|||
|
|
@ -8083,7 +8083,7 @@ extern void cxx_print_type (FILE *, tree, int);
|
|||
extern void cxx_print_identifier (FILE *, tree, int);
|
||||
extern void cxx_print_error_function (diagnostic_context *,
|
||||
const char *,
|
||||
struct diagnostic_info *);
|
||||
const diagnostic_info *);
|
||||
|
||||
/* in typeck.cc */
|
||||
/* Says how we should behave when comparing two arrays one of which
|
||||
|
|
|
|||
|
|
@ -101,8 +101,10 @@ static void print_instantiation_partial_context (diagnostic_context *,
|
|||
struct tinst_level *,
|
||||
location_t);
|
||||
static void maybe_print_constraint_context (diagnostic_context *);
|
||||
static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
|
||||
static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
|
||||
static void cp_diagnostic_starter (diagnostic_context *,
|
||||
const diagnostic_info *);
|
||||
static void cp_print_error_function (diagnostic_context *,
|
||||
const diagnostic_info *);
|
||||
|
||||
static bool cp_printer (pretty_printer *, text_info *, const char *,
|
||||
int, bool, bool, bool, bool *, const char **);
|
||||
|
|
@ -3530,7 +3532,7 @@ eh_spec_to_string (tree p, int /*v*/)
|
|||
/* Langhook for print_error_function. */
|
||||
void
|
||||
cxx_print_error_function (diagnostic_context *context, const char *file,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
char *prefix;
|
||||
if (file)
|
||||
|
|
@ -3544,7 +3546,7 @@ cxx_print_error_function (diagnostic_context *context, const char *file,
|
|||
|
||||
static void
|
||||
cp_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
diagnostic_report_current_module (context, diagnostic_location (diagnostic));
|
||||
cp_print_error_function (context, diagnostic);
|
||||
|
|
@ -3559,7 +3561,7 @@ cp_diagnostic_starter (diagnostic_context *context,
|
|||
a diagnostic message. Called from cp_diagnostic_starter. */
|
||||
static void
|
||||
cp_print_error_function (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
/* If we are in an instantiation context, current_function_decl is likely
|
||||
to be wrong, so just rely on print_instantiation_full_context. */
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ public:
|
|||
m_cur_children_array = nullptr;
|
||||
}
|
||||
void
|
||||
on_begin_diagnostic (diagnostic_info *) final override
|
||||
on_begin_diagnostic (const diagnostic_info &) final override
|
||||
{
|
||||
/* No-op. */
|
||||
}
|
||||
void
|
||||
on_end_diagnostic (diagnostic_info *diagnostic,
|
||||
on_end_diagnostic (const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind) final override;
|
||||
void on_diagram (const diagnostic_diagram &) final override
|
||||
{
|
||||
|
|
@ -188,7 +188,7 @@ json_from_metadata (const diagnostic_metadata *metadata)
|
|||
within current diagnostic group. */
|
||||
|
||||
void
|
||||
json_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
||||
json_output_format::on_end_diagnostic (const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
json::object *diag_obj = new json::object ();
|
||||
|
|
@ -202,7 +202,7 @@ json_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
|||
"must-not-happen"
|
||||
};
|
||||
/* Lose the trailing ": ". */
|
||||
const char *kind_text = diagnostic_kind_text[diagnostic->kind];
|
||||
const char *kind_text = diagnostic_kind_text[diagnostic.kind];
|
||||
size_t len = strlen (kind_text);
|
||||
gcc_assert (len > 2);
|
||||
gcc_assert (kind_text[len - 2] == ':');
|
||||
|
|
@ -217,15 +217,15 @@ json_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
|||
diag_obj->set_string ("message", pp_formatted_text (m_context.printer));
|
||||
pp_clear_output_area (m_context.printer);
|
||||
|
||||
if (char *option_text = m_context.make_option_name (diagnostic->option_index,
|
||||
if (char *option_text = m_context.make_option_name (diagnostic.option_index,
|
||||
orig_diag_kind,
|
||||
diagnostic->kind))
|
||||
diagnostic.kind))
|
||||
{
|
||||
diag_obj->set_string ("option", option_text);
|
||||
free (option_text);
|
||||
}
|
||||
|
||||
if (char *option_url = m_context.make_option_url (diagnostic->option_index))
|
||||
if (char *option_url = m_context.make_option_url (diagnostic.option_index))
|
||||
{
|
||||
diag_obj->set_string ("option_url", option_url);
|
||||
free (option_url);
|
||||
|
|
@ -249,7 +249,7 @@ json_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
|||
diag_obj->set_integer ("column-origin", m_context.m_column_origin);
|
||||
}
|
||||
|
||||
const rich_location *richloc = diagnostic->richloc;
|
||||
const rich_location *richloc = diagnostic.richloc;
|
||||
|
||||
json::array *loc_array = new json::array ();
|
||||
diag_obj->set ("locations", loc_array);
|
||||
|
|
@ -280,9 +280,9 @@ json_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
|||
TODO: inlining information
|
||||
TODO: macro expansion information. */
|
||||
|
||||
if (diagnostic->metadata)
|
||||
if (diagnostic.metadata)
|
||||
{
|
||||
json::object *metadata_obj = json_from_metadata (diagnostic->metadata);
|
||||
json::object *metadata_obj = json_from_metadata (diagnostic.metadata);
|
||||
diag_obj->set ("metadata", metadata_obj);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
{}
|
||||
|
||||
void add_notification_for_ice (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
sarif_builder *builder);
|
||||
void prepare_to_flush (diagnostic_context *context);
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
void
|
||||
on_nested_diagnostic (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind,
|
||||
sarif_builder *builder);
|
||||
void on_diagram (diagnostic_context *context,
|
||||
|
|
@ -90,7 +90,7 @@ class sarif_ice_notification : public sarif_object
|
|||
{
|
||||
public:
|
||||
sarif_ice_notification (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
sarif_builder *builder);
|
||||
};
|
||||
|
||||
|
|
@ -159,7 +159,8 @@ class sarif_builder
|
|||
public:
|
||||
sarif_builder (diagnostic_context *context);
|
||||
|
||||
void end_diagnostic (diagnostic_context *context, diagnostic_info *diagnostic,
|
||||
void end_diagnostic (diagnostic_context *context,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind);
|
||||
void emit_diagram (diagnostic_context *context,
|
||||
const diagnostic_diagram &diagram);
|
||||
|
|
@ -167,7 +168,7 @@ public:
|
|||
|
||||
void flush_to_file (FILE *outf);
|
||||
|
||||
json::array *make_locations_arr (diagnostic_info *diagnostic);
|
||||
json::array *make_locations_arr (const diagnostic_info &diagnostic);
|
||||
json::object *make_location_object (const rich_location &rich_loc,
|
||||
const logical_location *logical_loc);
|
||||
json::object *make_message_object (const char *msg) const;
|
||||
|
|
@ -177,7 +178,7 @@ public:
|
|||
|
||||
private:
|
||||
sarif_result *make_result_object (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind);
|
||||
void set_any_logical_locs_arr (json::object *location_obj,
|
||||
const logical_location *logical_loc);
|
||||
|
|
@ -208,7 +209,7 @@ private:
|
|||
json::object *make_tool_component_reference_object_for_cwe () const;
|
||||
json::object *
|
||||
make_reporting_descriptor_object_for_warning (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind,
|
||||
const char *option_text);
|
||||
json::object *make_reporting_descriptor_object_for_cwe_id (int cwe_id) const;
|
||||
|
|
@ -275,7 +276,7 @@ sarif_object::get_or_create_properties ()
|
|||
|
||||
void
|
||||
sarif_invocation::add_notification_for_ice (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
sarif_builder *builder)
|
||||
{
|
||||
m_success = false;
|
||||
|
|
@ -310,7 +311,7 @@ sarif_invocation::prepare_to_flush (diagnostic_context *context)
|
|||
|
||||
void
|
||||
sarif_result::on_nested_diagnostic (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t /*orig_diag_kind*/,
|
||||
sarif_builder *builder)
|
||||
{
|
||||
|
|
@ -318,7 +319,7 @@ sarif_result::on_nested_diagnostic (diagnostic_context *context,
|
|||
sometimes these will related to current_function_decl, but
|
||||
often they won't. */
|
||||
json::object *location_obj
|
||||
= builder->make_location_object (*diagnostic->richloc, NULL);
|
||||
= builder->make_location_object (*diagnostic.richloc, NULL);
|
||||
json::object *message_obj
|
||||
= builder->make_message_object (pp_formatted_text (context->printer));
|
||||
pp_clear_output_area (context->printer);
|
||||
|
|
@ -366,7 +367,7 @@ sarif_result::add_related_location (json::object *location_obj)
|
|||
DIAGNOSTIC is an internal compiler error. */
|
||||
|
||||
sarif_ice_notification::sarif_ice_notification (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
sarif_builder *builder)
|
||||
{
|
||||
/* "locations" property (SARIF v2.1.0 section 3.58.4). */
|
||||
|
|
@ -416,10 +417,10 @@ sarif_builder::sarif_builder (diagnostic_context *context)
|
|||
|
||||
void
|
||||
sarif_builder::end_diagnostic (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT)
|
||||
if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT)
|
||||
{
|
||||
m_invocation_obj->add_notification_for_ice (context, diagnostic, this);
|
||||
return;
|
||||
|
|
@ -528,7 +529,7 @@ make_rule_id_for_diagnostic_kind (diagnostic_t diag_kind)
|
|||
|
||||
sarif_result *
|
||||
sarif_builder::make_result_object (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
sarif_result *result_obj = new sarif_result ();
|
||||
|
|
@ -536,8 +537,8 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
/* "ruleId" property (SARIF v2.1.0 section 3.27.5). */
|
||||
/* Ideally we'd have an option_name for these. */
|
||||
if (char *option_text
|
||||
= context->make_option_name (diagnostic->option_index,
|
||||
orig_diag_kind, diagnostic->kind))
|
||||
= context->make_option_name (diagnostic.option_index,
|
||||
orig_diag_kind, diagnostic.kind))
|
||||
{
|
||||
/* Lazily create reportingDescriptor objects for and add to m_rules_arr.
|
||||
Set ruleId referencing them. */
|
||||
|
|
@ -569,10 +570,10 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
free (rule_id);
|
||||
}
|
||||
|
||||
if (diagnostic->metadata)
|
||||
if (diagnostic.metadata)
|
||||
{
|
||||
/* "taxa" property (SARIF v2.1.0 section 3.27.8). */
|
||||
if (int cwe_id = diagnostic->metadata->get_cwe ())
|
||||
if (int cwe_id = diagnostic.metadata->get_cwe ())
|
||||
{
|
||||
json::array *taxa_arr = new json::array ();
|
||||
json::object *cwe_id_obj
|
||||
|
|
@ -581,11 +582,11 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
result_obj->set ("taxa", taxa_arr);
|
||||
}
|
||||
|
||||
diagnostic->metadata->maybe_add_sarif_properties (*result_obj);
|
||||
diagnostic.metadata->maybe_add_sarif_properties (*result_obj);
|
||||
}
|
||||
|
||||
/* "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.kind))
|
||||
result_obj->set_string ("level", sarif_level);
|
||||
|
||||
/* "message" property (SARIF v2.1.0 section 3.27.11). */
|
||||
|
|
@ -599,7 +600,7 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
result_obj->set ("locations", locations_arr);
|
||||
|
||||
/* "codeFlows" property (SARIF v2.1.0 section 3.27.18). */
|
||||
if (const diagnostic_path *path = diagnostic->richloc->get_path ())
|
||||
if (const diagnostic_path *path = diagnostic.richloc->get_path ())
|
||||
{
|
||||
json::array *code_flows_arr = new json::array ();
|
||||
json::object *code_flow_obj = make_code_flow_object (*path);
|
||||
|
|
@ -612,7 +613,7 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
group. */
|
||||
|
||||
/* "fixes" property (SARIF v2.1.0 section 3.27.30). */
|
||||
const rich_location *richloc = diagnostic->richloc;
|
||||
const rich_location *richloc = diagnostic.richloc;
|
||||
if (richloc->get_num_fixit_hints ())
|
||||
{
|
||||
json::array *fix_arr = new json::array ();
|
||||
|
|
@ -630,7 +631,7 @@ sarif_builder::make_result_object (diagnostic_context *context,
|
|||
json::object *
|
||||
sarif_builder::
|
||||
make_reporting_descriptor_object_for_warning (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info &diagnostic,
|
||||
diagnostic_t /*orig_diag_kind*/,
|
||||
const char *option_text)
|
||||
{
|
||||
|
|
@ -643,7 +644,7 @@ make_reporting_descriptor_object_for_warning (diagnostic_context *context,
|
|||
it seems redundant compared to "id". */
|
||||
|
||||
/* "helpUri" property (SARIF v2.1.0 section 3.49.12). */
|
||||
if (char *option_url = context->make_option_url (diagnostic->option_index))
|
||||
if (char *option_url = context->make_option_url (diagnostic.option_index))
|
||||
{
|
||||
reporting_desc->set_string ("helpUri", option_url);
|
||||
free (option_url);
|
||||
|
|
@ -725,7 +726,7 @@ make_tool_component_reference_object_for_cwe () const
|
|||
- a "notification" object (SARIF v2.1.0 section 3.58.4). */
|
||||
|
||||
json::array *
|
||||
sarif_builder::make_locations_arr (diagnostic_info *diagnostic)
|
||||
sarif_builder::make_locations_arr (const diagnostic_info &diagnostic)
|
||||
{
|
||||
json::array *locations_arr = new json::array ();
|
||||
const logical_location *logical_loc = NULL;
|
||||
|
|
@ -733,7 +734,7 @@ sarif_builder::make_locations_arr (diagnostic_info *diagnostic)
|
|||
logical_loc = client_data_hooks->get_current_logical_location ();
|
||||
|
||||
json::object *location_obj
|
||||
= make_location_object (*diagnostic->richloc, logical_loc);
|
||||
= make_location_object (*diagnostic.richloc, logical_loc);
|
||||
locations_arr->append (location_obj);
|
||||
return locations_arr;
|
||||
}
|
||||
|
|
@ -1704,12 +1705,12 @@ public:
|
|||
m_builder.end_group ();
|
||||
}
|
||||
void
|
||||
on_begin_diagnostic (diagnostic_info *) final override
|
||||
on_begin_diagnostic (const diagnostic_info &) final override
|
||||
{
|
||||
/* No-op, */
|
||||
}
|
||||
void
|
||||
on_end_diagnostic (diagnostic_info *diagnostic,
|
||||
on_end_diagnostic (const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind) final override
|
||||
{
|
||||
m_builder.end_diagnostic (&m_context, diagnostic, orig_diag_kind);
|
||||
|
|
|
|||
|
|
@ -1077,7 +1077,7 @@ diagnostic_path::interprocedural_p () const
|
|||
|
||||
void
|
||||
default_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
diagnostic_report_current_module (context, diagnostic_location (diagnostic));
|
||||
pp_set_prefix (context->printer, diagnostic_build_prefix (context,
|
||||
|
|
@ -1095,7 +1095,7 @@ default_diagnostic_start_span_fn (diagnostic_context *context,
|
|||
|
||||
void
|
||||
default_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t)
|
||||
{
|
||||
char *saved_prefix = pp_take_prefix (context->printer);
|
||||
|
|
@ -1602,7 +1602,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic)
|
|||
m_diagnostic_groups.m_emission_count++;
|
||||
|
||||
pp_format (this->printer, &diagnostic->message, m_urlifier);
|
||||
m_output_format->on_begin_diagnostic (diagnostic);
|
||||
m_output_format->on_begin_diagnostic (*diagnostic);
|
||||
pp_output_formatted_text (this->printer);
|
||||
if (m_show_cwe)
|
||||
print_any_cwe (*diagnostic);
|
||||
|
|
@ -1610,7 +1610,7 @@ diagnostic_context::report_diagnostic (diagnostic_info *diagnostic)
|
|||
print_any_rules (*diagnostic);
|
||||
if (m_show_option_requested)
|
||||
print_option_information (*diagnostic, orig_diag_kind);
|
||||
m_output_format->on_end_diagnostic (diagnostic, orig_diag_kind);
|
||||
m_output_format->on_end_diagnostic (*diagnostic, orig_diag_kind);
|
||||
switch (m_extra_output_kind)
|
||||
{
|
||||
default:
|
||||
|
|
@ -2396,16 +2396,17 @@ diagnostic_text_output_format::~diagnostic_text_output_format ()
|
|||
}
|
||||
|
||||
void
|
||||
diagnostic_text_output_format::on_begin_diagnostic (diagnostic_info *diagnostic)
|
||||
diagnostic_text_output_format::on_begin_diagnostic (const diagnostic_info &diagnostic)
|
||||
{
|
||||
(*diagnostic_starter (&m_context)) (&m_context, diagnostic);
|
||||
(*diagnostic_starter (&m_context)) (&m_context, &diagnostic);
|
||||
}
|
||||
|
||||
void
|
||||
diagnostic_text_output_format::on_end_diagnostic (diagnostic_info *diagnostic,
|
||||
diagnostic_text_output_format::on_end_diagnostic (const diagnostic_info &diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
(*diagnostic_finalizer (&m_context)) (&m_context, diagnostic, orig_diag_kind);
|
||||
(*diagnostic_finalizer (&m_context)) (&m_context, &diagnostic,
|
||||
orig_diag_kind);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -171,13 +171,13 @@ struct diagnostic_info
|
|||
|
||||
/* Forward declarations. */
|
||||
typedef void (*diagnostic_starter_fn) (diagnostic_context *,
|
||||
diagnostic_info *);
|
||||
const diagnostic_info *);
|
||||
|
||||
typedef void (*diagnostic_start_span_fn) (diagnostic_context *,
|
||||
expanded_location);
|
||||
|
||||
typedef void (*diagnostic_finalizer_fn) (diagnostic_context *,
|
||||
diagnostic_info *,
|
||||
const diagnostic_info *,
|
||||
diagnostic_t);
|
||||
|
||||
typedef int (*diagnostic_option_enabled_cb) (int, unsigned, void *);
|
||||
|
|
@ -205,8 +205,8 @@ public:
|
|||
|
||||
virtual void on_begin_group () = 0;
|
||||
virtual void on_end_group () = 0;
|
||||
virtual void on_begin_diagnostic (diagnostic_info *) = 0;
|
||||
virtual void on_end_diagnostic (diagnostic_info *,
|
||||
virtual void on_begin_diagnostic (const diagnostic_info &) = 0;
|
||||
virtual void on_end_diagnostic (const diagnostic_info &,
|
||||
diagnostic_t orig_diag_kind) = 0;
|
||||
virtual void on_diagram (const diagnostic_diagram &diagram) = 0;
|
||||
|
||||
|
|
@ -233,8 +233,8 @@ public:
|
|||
~diagnostic_text_output_format ();
|
||||
void on_begin_group () override {}
|
||||
void on_end_group () override {}
|
||||
void on_begin_diagnostic (diagnostic_info *) override;
|
||||
void on_end_diagnostic (diagnostic_info *,
|
||||
void on_begin_diagnostic (const diagnostic_info &) override;
|
||||
void on_end_diagnostic (const diagnostic_info &,
|
||||
diagnostic_t orig_diag_kind) override;
|
||||
void on_diagram (const diagnostic_diagram &diagram) override;
|
||||
};
|
||||
|
|
@ -985,10 +985,11 @@ extern void diagnostic_append_note (diagnostic_context *, location_t,
|
|||
const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
|
||||
#endif
|
||||
extern char *diagnostic_build_prefix (diagnostic_context *, const diagnostic_info *);
|
||||
void default_diagnostic_starter (diagnostic_context *, diagnostic_info *);
|
||||
void default_diagnostic_starter (diagnostic_context *, const diagnostic_info *);
|
||||
void default_diagnostic_start_span_fn (diagnostic_context *,
|
||||
expanded_location);
|
||||
void default_diagnostic_finalizer (diagnostic_context *, diagnostic_info *,
|
||||
void default_diagnostic_finalizer (diagnostic_context *,
|
||||
const diagnostic_info *,
|
||||
diagnostic_t);
|
||||
void diagnostic_set_caret_max_width (diagnostic_context *context, int value);
|
||||
|
||||
|
|
|
|||
|
|
@ -1207,7 +1207,7 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
|
|||
*/
|
||||
static void
|
||||
gfc_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
char * kind_prefix = gfc_diagnostic_build_kind_prefix (context, diagnostic);
|
||||
|
||||
|
|
@ -1283,7 +1283,7 @@ gfc_diagnostic_start_span (diagnostic_context *context,
|
|||
|
||||
static void
|
||||
gfc_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic ATTRIBUTE_UNUSED,
|
||||
const diagnostic_info *diagnostic ATTRIBUTE_UNUSED,
|
||||
diagnostic_t orig_diag_kind ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pp_destroy_prefix (context->printer);
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ struct ggc_root_tab jit_root_tab[] =
|
|||
|
||||
static void
|
||||
jit_begin_diagnostic (diagnostic_context */*context*/,
|
||||
diagnostic_info */*diagnostic*/)
|
||||
const diagnostic_info */*diagnostic*/)
|
||||
{
|
||||
gcc_assert (gcc::jit::active_playback_ctxt);
|
||||
JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ());
|
||||
|
|
@ -576,7 +576,7 @@ jit_begin_diagnostic (diagnostic_context */*context*/,
|
|||
|
||||
static void
|
||||
jit_end_diagnostic (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t)
|
||||
{
|
||||
gcc_assert (gcc::jit::active_playback_ctxt);
|
||||
|
|
@ -584,7 +584,8 @@ jit_end_diagnostic (diagnostic_context *context,
|
|||
|
||||
/* Delegate to the playback context (and thence to the
|
||||
recording context). */
|
||||
gcc::jit::active_playback_ctxt->add_diagnostic (context, diagnostic);
|
||||
gcc_assert (diagnostic);
|
||||
gcc::jit::active_playback_ctxt->add_diagnostic (context, *diagnostic);
|
||||
}
|
||||
|
||||
/* Language hooks. */
|
||||
|
|
|
|||
|
|
@ -3513,7 +3513,7 @@ add_error_va (location *loc, const char *fmt, va_list ap)
|
|||
void
|
||||
playback::context::
|
||||
add_diagnostic (diagnostic_context *diag_context,
|
||||
struct diagnostic_info *diagnostic)
|
||||
const diagnostic_info &diagnostic)
|
||||
{
|
||||
/* At this point the text has been formatted into the pretty-printer's
|
||||
output buffer. */
|
||||
|
|
@ -3526,7 +3526,7 @@ add_diagnostic (diagnostic_context *diag_context,
|
|||
from the file/line/column since any playback location instances
|
||||
may have been garbage-collected away by now, so instead we create
|
||||
another recording::location directly. */
|
||||
location_t gcc_loc = diagnostic_location (diagnostic);
|
||||
location_t gcc_loc = diagnostic_location (&diagnostic);
|
||||
recording::location *rec_loc = NULL;
|
||||
if (gcc_loc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ public:
|
|||
|
||||
void
|
||||
add_diagnostic (diagnostic_context *context,
|
||||
struct diagnostic_info *diagnostic);
|
||||
const diagnostic_info &diagnostic);
|
||||
|
||||
void
|
||||
set_tree_location (tree t, location *loc);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ extern const char *lhd_decl_printable_name (tree, int);
|
|||
extern const char *lhd_dwarf_name (tree, int);
|
||||
extern int lhd_types_compatible_p (tree, tree);
|
||||
extern void lhd_print_error_function (diagnostic_context *,
|
||||
const char *, struct diagnostic_info *);
|
||||
const char *,
|
||||
const struct diagnostic_info *);
|
||||
extern void lhd_set_decl_assembler_name (tree decl);
|
||||
extern void lhd_overwrite_decl_assembler_name (tree decl, tree name);
|
||||
extern bool lhd_warn_unused_global_decl (const_tree);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ lhd_handle_option (size_t code ATTRIBUTE_UNUSED,
|
|||
an error. */
|
||||
void
|
||||
lhd_print_error_function (diagnostic_context *context, const char *file,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
if (diagnostic_last_function_changed (context, diagnostic))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ struct lang_hooks
|
|||
|
||||
/* Called by report_error_function to print out function name. */
|
||||
void (*print_error_function) (diagnostic_context *, const char *,
|
||||
struct diagnostic_info *);
|
||||
const struct diagnostic_info *);
|
||||
|
||||
/* Convert a character from the host's to the target's character
|
||||
set. The character should be in what C calls the "basic source
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
int plugin_is_GPL_compatible;
|
||||
|
||||
void
|
||||
noop_starter_fn (diagnostic_context *, diagnostic_info *)
|
||||
noop_starter_fn (diagnostic_context *, const diagnostic_info *)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ pass_test_groups::execute (function *fun)
|
|||
|
||||
void
|
||||
test_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
pp_set_prefix (context->printer, xstrdup ("PREFIX: "));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ static bool force_show_locus_color = false;
|
|||
|
||||
static void
|
||||
custom_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t)
|
||||
{
|
||||
bool old_show_color = pp_show_color (context->printer);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static diagnostic_finalizer_fn original_finalizer = NULL;
|
|||
|
||||
static void
|
||||
verify_unpacked_ranges (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
/* Verify that the locations are ad-hoc, not packed. */
|
||||
|
|
@ -56,7 +56,7 @@ verify_unpacked_ranges (diagnostic_context *context,
|
|||
|
||||
static void
|
||||
verify_no_columns (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic,
|
||||
const diagnostic_info *diagnostic,
|
||||
diagnostic_t orig_diag_kind)
|
||||
{
|
||||
/* Verify that the locations have no columns. */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
that caused an error. Called from all error and warning functions. */
|
||||
void
|
||||
diagnostic_report_current_function (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
location_t loc = diagnostic_location (diagnostic);
|
||||
diagnostic_report_current_module (context, loc);
|
||||
|
|
@ -44,7 +44,7 @@ diagnostic_report_current_function (diagnostic_context *context,
|
|||
|
||||
static void
|
||||
default_tree_diagnostic_starter (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
diagnostic_report_current_function (context, diagnostic);
|
||||
pp_set_prefix (context->printer, diagnostic_build_prefix (context,
|
||||
|
|
@ -241,7 +241,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
|
|||
template instantiation contexts. */
|
||||
void
|
||||
virt_loc_aware_diagnostic_finalizer (diagnostic_context *context,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
maybe_unwind_expanded_macro_loc (context, diagnostic_location (diagnostic));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ along with GCC; see the file COPYING3. If not see
|
|||
: current_function_decl)
|
||||
|
||||
void diagnostic_report_current_function (diagnostic_context *,
|
||||
diagnostic_info *);
|
||||
const diagnostic_info *);
|
||||
void virt_loc_aware_diagnostic_finalizer (diagnostic_context *,
|
||||
diagnostic_info *);
|
||||
const diagnostic_info *);
|
||||
|
||||
void tree_diagnostics_defaults (diagnostic_context *context);
|
||||
bool default_tree_printer (pretty_printer *, text_info *, const char *,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ cc1_plugin::plugin_context *cc1_plugin::current_context;
|
|||
|
||||
static void
|
||||
plugin_print_error_function (diagnostic_context *context, const char *file,
|
||||
diagnostic_info *diagnostic)
|
||||
const diagnostic_info *diagnostic)
|
||||
{
|
||||
if (current_function_decl != NULL_TREE
|
||||
&& DECL_NAME (current_function_decl) != NULL_TREE
|
||||
|
|
|
|||
Loading…
Reference in New Issue