[committed] analyzer: remove duplicated vfuncs

David Malcolm dmalcolm@redhat.com
Wed Mar 10 13:59:03 GMT 2021


Implement dyn_cast_callgraph_superedge once in callgraph_superedge,
rather than twice in the two subclasses.

Spotted whilst working on a patch for call summaries.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as c84faa9b7bb0f98ba15a8e29d21232243676d54d.

gcc/analyzer/ChangeLog:
	* supergraph.h
	(callgraph_superedge::dyn_cast_callgraph_superedge): New.
	(call_superedge::dyn_cast_callgraph_superedge): Delete.
	(return_superedge::dyn_cast_callgraph_superedge): Delete.
---
 gcc/analyzer/supergraph.h | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h
index fc4a753c5a4..5d1268e555f 100644
--- a/gcc/analyzer/supergraph.h
+++ b/gcc/analyzer/supergraph.h
@@ -371,6 +371,16 @@ class callgraph_superedge : public superedge
   void dump_label_to_pp (pretty_printer *pp, bool user_facing) const
     FINAL OVERRIDE;
 
+  callgraph_superedge *dyn_cast_callgraph_superedge () FINAL OVERRIDE
+  {
+    return this;
+  }
+  const callgraph_superedge *dyn_cast_callgraph_superedge () const
+    FINAL OVERRIDE
+  {
+    return this;
+  }
+
   function *get_callee_function () const;
   function *get_caller_function () const;
   tree get_callee_decl () const;
@@ -409,16 +419,6 @@ class call_superedge : public callgraph_superedge
   : callgraph_superedge (src, dst, SUPEREDGE_CALL, cedge)
   {}
 
-  callgraph_superedge *dyn_cast_callgraph_superedge () FINAL OVERRIDE
-  {
-    return this;
-  }
-  const callgraph_superedge *dyn_cast_callgraph_superedge () const
-    FINAL OVERRIDE
-  {
-    return this;
-  }
-
   call_superedge *dyn_cast_call_superedge () FINAL OVERRIDE
   {
     return this;
@@ -455,14 +455,6 @@ class return_superedge : public callgraph_superedge
   : callgraph_superedge (src, dst, SUPEREDGE_RETURN, cedge)
   {}
 
-  callgraph_superedge *dyn_cast_callgraph_superedge () FINAL OVERRIDE
-  {
-    return this;
-  }
-  const callgraph_superedge *dyn_cast_callgraph_superedge () const
-    FINAL OVERRIDE
-  { return this; }
-
   return_superedge *dyn_cast_return_superedge () FINAL OVERRIDE { return this; }
   const return_superedge *dyn_cast_return_superedge () const FINAL OVERRIDE
   {
-- 
2.26.2



More information about the Gcc-patches mailing list