* [PATCH, applied] Peel array types when peeling pointers from a type
@ 2021-05-25 10:07 Dodji Seketeli
0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2021-05-25 10:07 UTC (permalink / raw)
To: libabigail
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-25 10:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 10:07 [PATCH, applied] Peel array types when peeling pointers from a type Dodji Seketeli
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).