mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 15:34:34 +00:00
Cleanup is_class and is_compatible_with_class_type
There was two overloads of is_class, one for types and one for decls. Now that we have type_or_decl_base which is a common base type for both, having just one is_class function that takes a type_or_decl_base is more compact and easier to maintain. This patch does that. It also cleans up the declaration of the is_compatible_with_class_type function. * include/abg-fwd.h (is_class): Remove the overloads that take a decl_base or a type_base. Add one that takes a type_or_decl_base. (is_compatible_with_class_type): Make this take a reference to smart pointer, not just the smart pointer. * src/abg-ir.cc (is_class): Do the same as in the header file. (is_compatible_with_class_type): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
5a24ffcd61
commit
b07fcbcc0d
@ -237,22 +237,16 @@ shared_ptr<enum_type_decl>
|
||||
is_enum_type(const shared_ptr<decl_base>&);
|
||||
|
||||
class_decl*
|
||||
is_class_type(const decl_base*);
|
||||
|
||||
class_decl*
|
||||
is_class_type(const type_base*);
|
||||
is_class_type(const type_or_decl_base*);
|
||||
|
||||
shared_ptr<class_decl>
|
||||
is_class_type(const shared_ptr<type_base>);
|
||||
is_class_type(const shared_ptr<type_or_decl_base>&);
|
||||
|
||||
shared_ptr<class_decl>
|
||||
is_class_type(const shared_ptr<decl_base>);
|
||||
is_compatible_with_class_type(const shared_ptr<type_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>);
|
||||
is_compatible_with_class_type(const shared_ptr<decl_base>&);
|
||||
|
||||
pointer_type_def*
|
||||
is_pointer_type(type_base*);
|
||||
|
@ -5660,7 +5660,7 @@ is_enum_type(const type_base_sptr& t)
|
||||
///
|
||||
/// @return the class_decl if @p t is a class_decl or null otherwise.
|
||||
class_decl_sptr
|
||||
is_compatible_with_class_type(const type_base_sptr t)
|
||||
is_compatible_with_class_type(const type_base_sptr& t)
|
||||
{
|
||||
if (!t)
|
||||
return class_decl_sptr();
|
||||
@ -5674,7 +5674,7 @@ is_compatible_with_class_type(const type_base_sptr t)
|
||||
///
|
||||
/// @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)
|
||||
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.
|
||||
@ -5683,8 +5683,8 @@ is_compatible_with_class_type(const decl_base_sptr t)
|
||||
///
|
||||
/// @return the class_decl if @p t is a class_decl or null otherwise.
|
||||
class_decl*
|
||||
is_class_type(const type_base* t)
|
||||
{return dynamic_cast<class_decl*>(const_cast<type_base*>(t));}
|
||||
is_class_type(const type_or_decl_base* t)
|
||||
{return dynamic_cast<class_decl*>(const_cast<type_or_decl_base*>(t));}
|
||||
|
||||
/// Test whether a type is a class.
|
||||
///
|
||||
@ -5692,34 +5692,8 @@ is_class_type(const type_base* t)
|
||||
///
|
||||
/// @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();
|
||||
return dynamic_pointer_cast<class_decl>(t);
|
||||
}
|
||||
|
||||
/// Test if a the declaration of 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 t is a class_decl or null otherwise.
|
||||
class_decl*
|
||||
is_class_type(const decl_base *d)
|
||||
{return dynamic_cast<class_decl*>(const_cast<decl_base*>(d));}
|
||||
|
||||
/// 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));}
|
||||
is_class_type(const type_or_decl_base_sptr& d)
|
||||
{return dynamic_pointer_cast<class_decl>(d);}
|
||||
|
||||
/// Test whether a type is a pointer_type_def.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user