public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] Peel array types when peeling pointers from a type
Date: Tue, 25 May 2021 12:07:54 +0200	[thread overview]
Message-ID: <874ker5dol.fsf@redhat.com> (raw)

Hello,

In peel_typedef_pointer_or_reference_type, we want to peel typedefs
and pointer types (in general) from a given type.  We need to peel
array types as well, as those are conceptually a pointer-like type as
well.

This patch does that.

	* src/abg-ir.cc (peel_typedef_pointer_or_reference_type): In the
	overloads for type_base_sptr and type_base*, peel array type off
	as well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Applied to master.

---
 src/abg-ir.cc | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 85766edf..d0f8c6b8 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -6073,7 +6073,8 @@ peel_typedef_pointer_or_reference_type(const type_base_sptr type)
   type_base_sptr typ = type;
   while (is_typedef(typ)
 	 || is_pointer_type(typ)
-	 || is_reference_type(typ))
+	 || is_reference_type(typ)
+	 || is_array_type(typ))
     {
       if (typedef_decl_sptr t = is_typedef(typ))
 	typ = peel_typedef_type(t);
@@ -6083,6 +6084,9 @@ peel_typedef_pointer_or_reference_type(const type_base_sptr type)
 
       if (reference_type_def_sptr t = is_reference_type(typ))
 	typ = peel_reference_type(t);
+
+      if (const array_type_def_sptr t = is_array_type(typ))
+	typ = peel_array_type(t);
     }
 
   return typ;
@@ -6100,7 +6104,8 @@ peel_typedef_pointer_or_reference_type(const type_base* type)
 {
   while (is_typedef(type)
 	 || is_pointer_type(type)
-	 || is_reference_type(type))
+	 || is_reference_type(type)
+	 || is_array_type(type))
     {
       if (const typedef_decl* t = is_typedef(type))
 	type = peel_typedef_type(t);
@@ -6110,6 +6115,9 @@ peel_typedef_pointer_or_reference_type(const type_base* type)
 
       if (const reference_type_def* t = is_reference_type(type))
 	type = peel_reference_type(t);
+
+      if (const array_type_def* t = is_array_type(type))
+	type = peel_array_type(t);
     }
 
   return const_cast<type_base*>(type);
@@ -6130,6 +6138,7 @@ peel_pointer_or_reference_type(const type_base *type,
 {
   while (is_pointer_type(type)
 	 || is_reference_type(type)
+	 || is_array_type(type)
 	 || (peel_qual_type && is_qualified_type(type)))
     {
       if (const pointer_type_def* t = is_pointer_type(type))
-- 
2.30.0


-- 
		Dodji


                 reply	other threads:[~2021-05-25 10:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=874ker5dol.fsf@redhat.com \
    --to=dodji@redhat.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).