Look through typedefs when setting SIZE_OR_OFFSET_CHANGE_CATEGORY

* include/abg-fwd.h (is_class_type): Declare new functions.
	* src/abg-comp-filter.cc (harmful_filter::visit): Use the above to
	convert a type into a class.
	* src/abg-ir.cc (is_class_type): Define the new function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-04-07 09:54:52 +02:00
parent 23b7fa9ac2
commit ce1df6ff33
3 changed files with 35 additions and 2 deletions

View File

@ -158,6 +158,12 @@ is_typedef(const shared_ptr<type_base>);
shared_ptr<typedef_decl>
is_typedef(const shared_ptr<decl_base>);
shared_ptr<class_decl>
is_class_type(const shared_ptr<type_base>);
shared_ptr<class_decl>
is_class_type(const shared_ptr<decl_base>);
shared_ptr<class_decl>
look_through_decl_only_class(shared_ptr<class_decl>);

View File

@ -233,8 +233,8 @@ harmful_filter::visit(diff* d, bool pre)
if (type_size_changed(f, s)
|| data_member_offset_changed(f, s))
{
class_decl_sptr cl1 = dynamic_pointer_cast<class_decl>(f),
cl2 = dynamic_pointer_cast<class_decl>(s);
class_decl_sptr cl1 = is_class_type(f),
cl2 = is_class_type(s);
if ((cl1 && cl1->get_is_declaration_only())
|| (cl2 && cl2->get_is_declaration_only()))
// But do not compare a declaration-only class to another

View File

@ -1648,6 +1648,33 @@ typedef_decl_sptr
is_typedef(const decl_base_sptr d)
{return is_typedef(is_type(d));}
/// Test whether 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_class_type(const type_base_sptr t)
{
if (!t)
return class_decl_sptr();
type_base_sptr ty = strip_typedef(t);
return dynamic_pointer_cast<class_decl>(ty);
}
/// Test whether a type is a class.
///
/// This function looks through typedefs.
///
/// @parm d the declaration of the type to consider.
///
/// @return the class_decl if @p d is a class_decl or null otherwise.
class_decl_sptr
is_class_type(const decl_base_sptr d)
{return is_class_type(is_type(d));}
/// If a class is a decl-only class, get its definition. Otherwise,
/// just return the initial class.
///