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>
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*);
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))
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.