analyzer: use 'final' and 'override' where appropriate
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 23 May 2022 19:08:13 +0000 (15:08 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 23 May 2022 19:08:13 +0000 (15:08 -0400)
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>
gcc/analyzer/call-info.cc
gcc/analyzer/engine.cc
gcc/analyzer/region-model.cc
gcc/analyzer/sm-malloc.cc
gcc/analyzer/supergraph.h
gcc/analyzer/svalue.cc
gcc/analyzer/varargs.cc

index 2d3fe0a..b3ff51e 100644 (file)
@@ -96,7 +96,7 @@ call_info::add_events_to_path (checker_path *emission_path,
        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);
     }
index c59374b..5ccfedf 100644 (file)
@@ -328,7 +328,7 @@ public:
   }
 
   state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED,
-                                   tree var)
+                                   tree var) final override
   {
     logger * const logger = get_logger ();
     LOG_FUNC (logger);
@@ -342,7 +342,7 @@ public:
     return current;
   }
   state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED,
-                                   const svalue *sval)
+                                   const svalue *sval) final override
   {
     logger * const logger = get_logger ();
     LOG_FUNC (logger);
@@ -355,7 +355,7 @@ public:
   void set_next_state (const gimple *stmt,
                       tree var,
                       state_machine::state_t to,
-                      tree origin)
+                      tree origin) final override
   {
     logger * const logger = get_logger ();
     LOG_FUNC (logger);
@@ -384,7 +384,7 @@ public:
   void set_next_state (const gimple *stmt,
                       const svalue *sval,
                       state_machine::state_t to,
-                      tree origin)
+                      tree origin) final override
   {
     logger * const logger = get_logger ();
     LOG_FUNC (logger);
@@ -1597,7 +1597,7 @@ public:
     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)
       return ev.formatted_print
index 6f6a061..6b49719 100644 (file)
@@ -1640,7 +1640,7 @@ public:
 
   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),
            "parameter %i of %qD marked with attribute %qs",
index abdce6b..3c0f890 100644 (file)
@@ -1015,7 +1015,8 @@ public:
 
   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 &)base_other;
@@ -1119,7 +1120,8 @@ public:
 
   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 &)base_other;
index cc53fcb..42c6df5 100644 (file)
@@ -308,7 +308,8 @@ class superedge : public dedge<supergraph_traits>
 
   void dump (pretty_printer *pp) 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,
                                 bool user_facing) const = 0;
index ed289c6..2f91494 100644 (file)
@@ -600,13 +600,13 @@ public:
   involvement_visitor (const svalue *needle)
   : 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)
       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)
       m_found = true;
index 3f15ada..2d27484 100644 (file)
@@ -466,7 +466,7 @@ public:
     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;
     return warning_at (rich_loc, get_controlling_option (),