mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-20 17:00:36 +00:00
Show aliases of functions with changed sub-types
The report emitted by abidiff now tells the user about the aliases of the current function, when that function has some sub-type changes. * include/abg-ir.h (elf_symbol::get_aliases_id_string): Declare new overload. * src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define new overload. * src/abg-comparison.cc (corpus_diff::report): For functions with sub-type changes report their aliases. Do not do this if the function is a constructor or destructor because these almost always have aliases, at least with GCC and the developer most certainly has not done anything special for that; she would thus be uselessly surprised by that remote implementation detail. * tests/data/test-diff-dwarf/test5-report.txt: Adjust test. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
43c06a8746
commit
25dc383b40
@ -455,6 +455,9 @@ public:
|
||||
get_aliases_id_string(const string_elf_symbols_map_type& symtab,
|
||||
bool include_symbol_itself = true) const;
|
||||
|
||||
string
|
||||
get_aliases_id_string(bool include_symbol_itself = true) const;
|
||||
|
||||
static bool
|
||||
get_name_and_version_from_id(const string& id,
|
||||
string& name,
|
||||
|
@ -13748,9 +13748,23 @@ corpus_diff::report(ostream& out, const string& indent) const
|
||||
|
||||
if (diff->to_be_reported())
|
||||
{
|
||||
function_decl_sptr fn = (*i)->first_function_decl();
|
||||
out << indent << " [C]'"
|
||||
<< (*i)->first_function_decl()->get_pretty_representation()
|
||||
<< fn->get_pretty_representation()
|
||||
<< "' has some indirect sub-type changes:\n";
|
||||
if (fn->get_symbol()->has_aliases()
|
||||
&& !(is_member_function(fn)
|
||||
&& get_member_function_is_ctor(fn))
|
||||
&& !(is_member_function(fn)
|
||||
&& get_member_function_is_dtor(fn)))
|
||||
{
|
||||
out << indent << " "
|
||||
<< "Please note that the symbol of this function is "
|
||||
<< fn->get_symbol()->get_id_string()
|
||||
<< "\n and it aliases: "
|
||||
<< fn->get_symbol()->get_aliases_id_string(false)
|
||||
<< "\n";
|
||||
}
|
||||
diff->report(out, indent + " ");
|
||||
out << "\n";
|
||||
emitted |= true;
|
||||
|
@ -812,6 +812,38 @@ elf_symbol::get_aliases_id_string(const string_elf_symbols_map_type& syms,
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Return a comma separated list of the id of the current symbol as
|
||||
/// well as the id string of its aliases.
|
||||
///
|
||||
/// @param include_symbol_itself if set to true, then the name of the
|
||||
/// current symbol is included in the list of alias names that is emitted.
|
||||
///
|
||||
/// @return the string.
|
||||
string
|
||||
elf_symbol::get_aliases_id_string(bool include_symbol_itself) const
|
||||
{
|
||||
vector<elf_symbol_sptr> aliases;
|
||||
if (include_symbol_itself)
|
||||
aliases.push_back(get_main_symbol());
|
||||
|
||||
for (elf_symbol_sptr a = get_next_alias();
|
||||
a && a.get() != get_main_symbol().get();
|
||||
a = a->get_next_alias())
|
||||
aliases.push_back(a);
|
||||
|
||||
string result;
|
||||
for (vector<elf_symbol_sptr>::const_iterator i = aliases.begin();
|
||||
i != aliases.end();
|
||||
++i)
|
||||
{
|
||||
if (i != aliases.begin())
|
||||
result += ", ";
|
||||
result += (*i)->get_id_string();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Given the ID of a symbol, get the name and the version of said
|
||||
/// symbol.
|
||||
///
|
||||
|
@ -4,6 +4,8 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
|
||||
1 function with some indirect sub-type change:
|
||||
|
||||
[C]'function C0 foo()' has some indirect sub-type changes:
|
||||
Please note that the symbol of this function is _ZN2C0C2Ev
|
||||
and it aliases: _ZN2C0C1Ev, _Z3foov
|
||||
return type changed:
|
||||
entity changed from 'class C0' to compatible type 'typedef c0_type'
|
||||
1 data member change:
|
||||
|
Loading…
Reference in New Issue
Block a user