]> sourceware.org Git - libabigail.git/commitdiff
Accept base classes which types are compatible with class type
authorDodji Seketeli <dodji@redhat.com>
Wed, 26 Aug 2015 10:06:46 +0000 (12:06 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sat, 29 Aug 2015 14:23:15 +0000 (16:23 +0200)
Until now, a base class had to be a class itself.  It couldn't be a
typedef to a class, for instance. Clang's debug info does allow base
classes which are compatible with classes (e.g, typedefs of classes),
which is correct.  We ought to accept that.  Hence this patch.

* include/abg-fwd.h (is_compatible_with_class_type): Declare a new
overload.
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Rather
than requiring that base classes be of class type, just require
that they be compatible with class types.
* src/abg-ir.cc (is_compatible_with_class_type): Define a new
overload.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-fwd.h
src/abg-dwarf-reader.cc
src/abg-ir.cc

index 0d2544734a4dd9400f1380c6d6a86929ceab96fd..3bd56009588f049285fdf26c9b6b18a74e5e3a13 100644 (file)
@@ -231,6 +231,9 @@ is_class_type(const shared_ptr<decl_base>);
 shared_ptr<class_decl>
 is_compatible_with_class_type(const shared_ptr<type_base>);
 
+shared_ptr<class_decl>
+is_compatible_with_class_type(const shared_ptr<decl_base>);
+
 pointer_type_def*
 is_pointer_type(type_base*);
 
index d3e0513867af72fe24df8fa9453ae5ac1859dc87..73dbd9bcea83b74066fedf07c91279dc3195767c 100644 (file)
@@ -6646,7 +6646,7 @@ build_class_type_and_add_to_ir(read_context&      ctxt,
                                       type_die_is_in_alternate_debug_info,
                                       called_from_public_decl,
                                       where_offset);
-             class_decl_sptr b = dynamic_pointer_cast<class_decl>(base_type);
+             class_decl_sptr b = is_compatible_with_class_type(base_type);
              if (!b)
                continue;
              if (lookup_type_in_scope(base_type->get_name(), result))
index bf815e6629bde7eaee32220b3f9930e63b49cac4..be27b3ce845caefeb8dce908e66d442106b9db3f 100644 (file)
@@ -4385,6 +4385,15 @@ is_compatible_with_class_type(const type_base_sptr t)
   return is_class_type(ty);
 }
 
+/// Test if a type is a class. This function looks through typedefs.
+///
+/// @parm t the type to consider.
+///
+/// @return the class_decl if @p t is a class_decl or null otherwise.
+class_decl_sptr
+is_compatible_with_class_type(const decl_base_sptr t)
+{return is_compatible_with_class_type(is_type(t));}
+
 /// Test whether a type is a class.
 ///
 /// @parm t the type to consider.
This page took 0.054852 seconds and 5 git commands to generate.