From 6b78729186060cf96c0b4e0f3eacf155f4e90376 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 10 Mar 2021 12:00:34 -0500 Subject: [PATCH] committed: analyzer: remove duplicated vfuncs 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. 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 {