mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-13 21:00:57 +00:00
Use mangled name for decl comparison when it's present
* src/abg-ir.cc (decl_base::operator==(const decl_base& other)
const): Use the mangled name of the decl in priority.
* src/abg-hash.cc (struct decl_base:#️⃣:operator()): Likewise.
* src/abg-comparison.cc (function_decl_diff::report): Do not
report a function name change if it doesn't involve a mangled name
change. This might change when we start dealing with templates.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
b386b28eb4
commit
dd346bab80
@ -4486,9 +4486,11 @@ function_decl_diff::report(ostream& out, const string& indent) const
|
||||
context(), out, indent);
|
||||
|
||||
string qn1 = first_function_decl()->get_qualified_name(),
|
||||
qn2 = second_function_decl()->get_qualified_name();
|
||||
qn2 = second_function_decl()->get_qualified_name(),
|
||||
mn1 = first_function_decl()->get_mangled_name(),
|
||||
mn2 = second_function_decl()->get_mangled_name();
|
||||
|
||||
if (qn1 != qn2)
|
||||
if (qn1 != qn2 && mn1 != mn2)
|
||||
{
|
||||
string frep1 = first_function_decl()->get_pretty_representation(),
|
||||
frep2 = second_function_decl()->get_pretty_representation();
|
||||
|
@ -84,13 +84,12 @@ struct decl_base::hash
|
||||
if (d.hash_ == 0)
|
||||
{
|
||||
std::tr1::hash<string> str_hash;
|
||||
std::tr1::hash<unsigned> unsigned_hash;
|
||||
|
||||
size_t v = str_hash(typeid(d).name());
|
||||
if (!d.get_name().empty())
|
||||
if (!d.get_mangled_name().empty())
|
||||
v = hashing::combine_hashes(v, str_hash(d.get_mangled_name()));
|
||||
else if (!d.get_name().empty())
|
||||
v = hashing::combine_hashes(v, str_hash(d.get_qualified_name()));
|
||||
if (d.get_location())
|
||||
v = hashing::combine_hashes(v, unsigned_hash(d.get_location()));
|
||||
if (is_member_decl(d))
|
||||
{
|
||||
v = hashing::combine_hashes(v, get_member_access_specifier(d));
|
||||
|
@ -455,8 +455,14 @@ decl_base::get_qualified_name() const
|
||||
bool
|
||||
decl_base::operator==(const decl_base& other) const
|
||||
{
|
||||
if (get_name() != other.get_name())
|
||||
return false;
|
||||
if (!get_mangled_name().empty())
|
||||
{
|
||||
if (get_mangled_name() != other.get_mangled_name())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (get_name() != other.get_name())
|
||||
return false;
|
||||
|
||||
if (is_member_decl(this) && is_member_decl(other))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user