analyzer: use 'final' and 'override' where appropriate

gcc/analyzer/ChangeLog:
	* call-info.cc: Add "final" and "override" to all vfunc
	implementations that were missing them, as appropriate.
	* engine.cc: Likewise.
	* region-model.cc: Likewise.
	* sm-malloc.cc: Likewise.
	* supergraph.h: Likewise.
	* svalue.cc: Likewise.
	* varargs.cc: Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
David Malcolm 2022-05-23 15:08:13 -04:00
parent a239aff82c
commit 2ac1459f04
7 changed files with 16 additions and 13 deletions

View File

@ -96,7 +96,7 @@ call_info::add_events_to_path (checker_path *emission_path,
m_call_info (call_info) m_call_info (call_info)
{} {}
label_text get_desc (bool can_colorize) const label_text get_desc (bool can_colorize) const final override
{ {
return m_call_info->get_desc (can_colorize); return m_call_info->get_desc (can_colorize);
} }

View File

@ -328,7 +328,7 @@ public:
} }
state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED,
tree var) tree var) final override
{ {
logger * const logger = get_logger (); logger * const logger = get_logger ();
LOG_FUNC (logger); LOG_FUNC (logger);
@ -342,7 +342,7 @@ public:
return current; return current;
} }
state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED,
const svalue *sval) const svalue *sval) final override
{ {
logger * const logger = get_logger (); logger * const logger = get_logger ();
LOG_FUNC (logger); LOG_FUNC (logger);
@ -355,7 +355,7 @@ public:
void set_next_state (const gimple *stmt, void set_next_state (const gimple *stmt,
tree var, tree var,
state_machine::state_t to, state_machine::state_t to,
tree origin) tree origin) final override
{ {
logger * const logger = get_logger (); logger * const logger = get_logger ();
LOG_FUNC (logger); LOG_FUNC (logger);
@ -384,7 +384,7 @@ public:
void set_next_state (const gimple *stmt, void set_next_state (const gimple *stmt,
const svalue *sval, const svalue *sval,
state_machine::state_t to, state_machine::state_t to,
tree origin) tree origin) final override
{ {
logger * const logger = get_logger (); logger * const logger = get_logger ();
LOG_FUNC (logger); LOG_FUNC (logger);
@ -1597,7 +1597,7 @@ public:
return false; return false;
} }
label_text describe_final_event (const evdesc::final_event &ev) label_text describe_final_event (const evdesc::final_event &ev) final override
{ {
if (m_stack_pop_event) if (m_stack_pop_event)
return ev.formatted_print return ev.formatted_print

View File

@ -1640,7 +1640,7 @@ public:
const char *get_kind () const final override { return "reason_attr_access"; } const char *get_kind () const final override { return "reason_attr_access"; }
void emit () const void emit () const final override
{ {
inform (DECL_SOURCE_LOCATION (m_callee_fndecl), inform (DECL_SOURCE_LOCATION (m_callee_fndecl),
"parameter %i of %qD marked with attribute %qs", "parameter %i of %qD marked with attribute %qs",

View File

@ -1015,7 +1015,8 @@ public:
const char *get_kind () const final override { return "possible_null_arg"; } const char *get_kind () const final override { return "possible_null_arg"; }
bool subclass_equal_p (const pending_diagnostic &base_other) const bool subclass_equal_p (const pending_diagnostic &base_other)
const final override
{ {
const possible_null_arg &sub_other const possible_null_arg &sub_other
= (const possible_null_arg &)base_other; = (const possible_null_arg &)base_other;
@ -1119,7 +1120,8 @@ public:
const char *get_kind () const final override { return "null_arg"; } const char *get_kind () const final override { return "null_arg"; }
bool subclass_equal_p (const pending_diagnostic &base_other) const bool subclass_equal_p (const pending_diagnostic &base_other)
const final override
{ {
const null_arg &sub_other const null_arg &sub_other
= (const null_arg &)base_other; = (const null_arg &)base_other;

View File

@ -308,7 +308,8 @@ class superedge : public dedge<supergraph_traits>
void dump (pretty_printer *pp) const; void dump (pretty_printer *pp) const;
void dump () const; void dump () const;
void dump_dot (graphviz_out *gv, const dump_args_t &args) const; void dump_dot (graphviz_out *gv, const dump_args_t &args)
const final override;
virtual void dump_label_to_pp (pretty_printer *pp, virtual void dump_label_to_pp (pretty_printer *pp,
bool user_facing) const = 0; bool user_facing) const = 0;

View File

@ -600,13 +600,13 @@ public:
involvement_visitor (const svalue *needle) involvement_visitor (const svalue *needle)
: m_needle (needle), m_found (false) {} : m_needle (needle), m_found (false) {}
void visit_initial_svalue (const initial_svalue *candidate) void visit_initial_svalue (const initial_svalue *candidate) final override
{ {
if (candidate == m_needle) if (candidate == m_needle)
m_found = true; m_found = true;
} }
void visit_conjured_svalue (const conjured_svalue *candidate) void visit_conjured_svalue (const conjured_svalue *candidate) final override
{ {
if (candidate == m_needle) if (candidate == m_needle)
m_found = true; m_found = true;

View File

@ -466,7 +466,7 @@ public:
return va_list_sm_diagnostic::subclass_equal_p (other); return va_list_sm_diagnostic::subclass_equal_p (other);
} }
bool emit (rich_location *rich_loc) bool emit (rich_location *rich_loc) final override
{ {
auto_diagnostic_group d; auto_diagnostic_group d;
return warning_at (rich_loc, get_controlling_option (), return warning_at (rich_loc, get_controlling_option (),