mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-19 00:14:33 +00:00
Fix comparison in qualified_type_diff::has_changes
* src/abg-comparison.cc (qualified_type_diff::has_changes): Make this stupid and simple, now that we have (fast) canonical type based comparison. * include/abg-ir.h (qualified_type_diff::operator==): Add an overload for qualified_type_diff here. (operator==): Likewise. * src/abg-ir.cc (qualified_type_diff::operator==): Define it. (operator==): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
43c908ed15
commit
fa4b7c8069
@ -1469,6 +1469,9 @@ public:
|
||||
virtual bool
|
||||
operator==(const type_base&) const;
|
||||
|
||||
virtual bool
|
||||
operator==(const qualified_type_def&) const;
|
||||
|
||||
CV
|
||||
get_cv_quals() const;
|
||||
|
||||
@ -1493,6 +1496,9 @@ public:
|
||||
virtual ~qualified_type_def();
|
||||
}; // end class qualified_type_def.
|
||||
|
||||
bool
|
||||
operator==(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
|
||||
|
||||
qualified_type_def::CV
|
||||
operator|(qualified_type_def::CV, qualified_type_def::CV);
|
||||
|
||||
|
@ -7733,28 +7733,7 @@ qualified_type_diff::get_pretty_representation() const
|
||||
/// @return true iff the current diff node carries a change.
|
||||
bool
|
||||
qualified_type_diff::has_changes() const
|
||||
{
|
||||
bool l = false;
|
||||
char fcv = first_qualified_type()->get_cv_quals(),
|
||||
scv = second_qualified_type()->get_cv_quals();
|
||||
|
||||
if (fcv != scv)
|
||||
{
|
||||
if ((fcv & qualified_type_def::CV_CONST)
|
||||
!= (scv & qualified_type_def::CV_CONST))
|
||||
l |= true;
|
||||
if ((fcv & qualified_type_def::CV_VOLATILE)
|
||||
!= (scv & qualified_type_def::CV_RESTRICT))
|
||||
l |= true;
|
||||
if ((fcv & qualified_type_def::CV_RESTRICT)
|
||||
!= (scv & qualified_type_def::CV_RESTRICT))
|
||||
l |= true;
|
||||
}
|
||||
|
||||
return (underlying_type_diff()
|
||||
? underlying_type_diff()->has_changes() || l
|
||||
: l);
|
||||
}
|
||||
{return first_qualified_type() != second_qualified_type();}
|
||||
|
||||
/// @return true iff the current diff node carries local changes.
|
||||
bool
|
||||
|
@ -7073,6 +7073,24 @@ qualified_type_def::operator==(const type_base& o) const
|
||||
return *this == *other;
|
||||
}
|
||||
|
||||
/// Equality operator for qualified types.
|
||||
///
|
||||
/// Note that this function does not check for equality of the scopes.
|
||||
/// Also, this re-uses the equality operator above that takes a
|
||||
/// decl_base.
|
||||
///
|
||||
///@param o the other qualified type to compare against.
|
||||
///
|
||||
/// @return true iff both qualified types are equal.
|
||||
bool
|
||||
qualified_type_def::operator==(const qualified_type_def& o) const
|
||||
{
|
||||
const decl_base* other = dynamic_cast<const decl_base*>(&o);
|
||||
if (!other)
|
||||
return false;
|
||||
return *this == *other;
|
||||
}
|
||||
|
||||
/// Implementation for the virtual qualified name builder for @ref
|
||||
/// qualified_type_def.
|
||||
///
|
||||
@ -7214,6 +7232,24 @@ qualified_type_def::get_underlying_type() const
|
||||
return type_base_sptr(priv_->underlying_type_);
|
||||
}
|
||||
|
||||
/// Non-member equality operator for @ref qualified_type_def
|
||||
///
|
||||
/// @param l the left-hand side of the equality operator
|
||||
///
|
||||
/// @param r the right-hand side of the equality operator
|
||||
///
|
||||
/// @return true iff @p l and @p r equals.
|
||||
bool
|
||||
operator==(const qualified_type_def_sptr& l, const qualified_type_def_sptr& r)
|
||||
{
|
||||
if (l.get() == r.get())
|
||||
return true;
|
||||
if (!!l != !!r)
|
||||
return false;
|
||||
|
||||
return *l == *r;
|
||||
}
|
||||
|
||||
/// Overloaded bitwise OR operator for cv qualifiers.
|
||||
qualified_type_def::CV
|
||||
operator| (qualified_type_def::CV lhs,
|
||||
|
Loading…
Reference in New Issue
Block a user