abg-ir.cc: Fix peel_typedef_type(const type_base*). upstream
authorGiuliano Procida <gprocida@google.com>
Thu, 19 Mar 2020 11:13:14 +0000 (11:13 +0000)
committerDodji Seketeli <dodji@redhat.com>
Fri, 20 Mar 2020 22:49:43 +0000 (23:49 +0100)
The various peel_*_type functions are supposed to return either an
underlying type (when something can be "peeled") or the original
type (when not).

This overload of peel_typedef_type currently returns null if the type
isn't a typedef. This patch corrects this.

The bug hasn't bitten as all existing calls are protected by an
is_typedef check. Note that the recursive calls within the function
are to the other (const type_base_sptr&) overload.

* src/abg-ir.cc (peel_typedef_type): In the const type_base*
        overload, return the original argument rather than null if the
        type isn't actually a typedef.

Signed-off-by: Giuliano Procida <gprocida@google.com>
src/abg-ir.cc

index 1302329557a9a5640601f840259f86ccae20fcb6..2853fe6c812085a16c1f1f71ad58961d49549c3d 100644 (file)
@@ -5249,7 +5249,7 @@ peel_typedef_type(const type_base* type)
 {
   const typedef_decl* t = is_typedef(type);
   if (!t)
-    return t;
+    return type;
 
   return peel_typedef_type(t->get_underlying_type()).get();
 }