public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Matthias Maennich <maennich@google.com>
To: Giuliano Procida <gprocida@google.com>
Cc: libabigail@sourceware.org, dodji@seketeli.org, kernel-team@android.com
Subject: Re: [PATCH 2/3] Fix inheritance of scope_decl::insert_member_decl
Date: Fri, 10 Jul 2020 18:27:32 +0200	[thread overview]
Message-ID: <20200710162732.GH995455@google.com> (raw)
In-Reply-To: <20200709182250.1677238-3-gprocida@google.com>

On Thu, Jul 09, 2020 at 07:22:49PM +0100, Giuliano Procida wrote:
>The classes class_decl, class_or_union and scope_decl derive from each
>other. The method insert_member_decl is declared virtual and defined
>in each of these. Unfortunately, it has different argument types in
>the base scope_decl class.
>
>Most calls to insert_member_decl are at a statically known class, but
>in insert_decl_into_scope the method is called via a scope_decl
>pointer. There is the possibility that this could be a type derived
>from scope_decl rather than scope_decl itself, in which case the base
>method would be called, not as intended.
>
>This commit adjusts the type of the member argument to
>scope_decl::insert_member_decl to match the other two classes and
>eliminates the last trigger of Clang's -Werror-overloaded-virtual.
>
>	* include/abg-ir.h (scope_decl::insert_member_decl): Change
>	type of member argument from const decl_base_sptr& to plain
>	decl_base_sptr.
>	* src/abg-ir.cc (scope_decl::insert_member_decl): Likewise.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>---
> include/abg-ir.h | 3 +--
> src/abg-ir.cc    | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/include/abg-ir.h b/include/abg-ir.h
>index c2b66c4c..ea6a7ce4 100644
>--- a/include/abg-ir.h
>+++ b/include/abg-ir.h
>@@ -1653,8 +1653,7 @@ protected:
>   add_member_decl(const decl_base_sptr& member);
>
>   virtual decl_base_sptr
>-  insert_member_decl(const decl_base_sptr& member,
>-		     declarations::iterator before);
>+  insert_member_decl(decl_base_sptr member, declarations::iterator before);
>
>   virtual void
>   remove_member_decl(decl_base_sptr member);
>diff --git a/src/abg-ir.cc b/src/abg-ir.cc
>index a434ec69..a257cf67 100644
>--- a/src/abg-ir.cc
>+++ b/src/abg-ir.cc
>@@ -6081,7 +6081,7 @@ scope_decl::add_member_decl(const decl_base_sptr& member)
> /// @param before an interator pointing to the element before which
> /// the new member should be inserted.
> decl_base_sptr
>-scope_decl::insert_member_decl(const decl_base_sptr& member,
>+scope_decl::insert_member_decl(decl_base_sptr member,
> 			       declarations::iterator before)
> {
>   ABG_ASSERT(!member->get_scope());
>-- 
>2.27.0.383.g050319c2ae-goog
>

  reply	other threads:[~2020-07-10 16:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 16:45 [PATCH] Drop traversable_base::traverse method Giuliano Procida
2020-07-09 18:22 ` [PATCH 0/3] Bug 21485 - problems compiling with clang Giuliano Procida
2020-07-09 18:22   ` [PATCH 1/3] Drop traversable_base::traverse method Giuliano Procida
2020-07-10 16:26     ` Matthias Maennich
2020-07-27 16:03     ` Dodji Seketeli
2020-07-09 18:22   ` [PATCH 2/3] Fix inheritance of scope_decl::insert_member_decl Giuliano Procida
2020-07-10 16:27     ` Matthias Maennich [this message]
2020-07-27 16:14     ` Dodji Seketeli
2020-07-09 18:22   ` [PATCH 3/3] Enable Clang's -Werror-overloaded-virtual Giuliano Procida
2020-07-09 18:51     ` [PATCH v2 " Giuliano Procida
2020-07-10 16:28       ` Matthias Maennich
2020-07-27 16:26       ` Dodji Seketeli
2020-07-27 16:27   ` [PATCH 0/3] Bug 21485 - problems compiling with clang Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710162732.GH995455@google.com \
    --to=maennich@google.com \
    --cc=dodji@seketeli.org \
    --cc=gprocida@google.com \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).