mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-15 22:44:41 +00:00
Report vtable changes in top-level function change reports
Up to know we were not reporting vtable changes on top-level function change reports. This patch adds that feature. * src/abg-comparison.cc (function_decl_diff::report): Report about virtual-ness and vtable offset changes. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: New test input file. * tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test28-vtable-changes-v{0,1}.cc: Source code of the input binaries above. * tests/data/Makefile.am: Add the new test input above to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Add the new test input above to the list of input this test harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
0cd814766b
commit
ad0ec3fd20
@ -10576,6 +10576,34 @@ function_decl_diff::report(ostream& out, const string& indent) const
|
||||
<< " is now declared inline\n";
|
||||
}
|
||||
|
||||
// Report about vtable offset changes.
|
||||
if (is_member_function(ff) && is_member_function(sf))
|
||||
{
|
||||
bool ff_is_virtual = get_member_function_is_virtual(ff),
|
||||
sf_is_virtual = get_member_function_is_virtual(sf);
|
||||
if (ff_is_virtual != sf_is_virtual)
|
||||
{
|
||||
out << indent;
|
||||
if (ff_is_virtual)
|
||||
out << ff->get_pretty_representation()
|
||||
<< " is no more declared virtual\n";
|
||||
else
|
||||
out << ff->get_pretty_representation()
|
||||
<< " is now declared virtual\n";
|
||||
}
|
||||
|
||||
size_t ff_vtable_offset = get_member_function_vtable_offset(ff),
|
||||
sf_vtable_offset = get_member_function_vtable_offset(sf);
|
||||
if (ff_is_virtual && sf_is_virtual
|
||||
&& (ff_vtable_offset != sf_vtable_offset))
|
||||
{
|
||||
out << indent
|
||||
<< "the vtable offset of " << ff->get_pretty_representation()
|
||||
<< " changed from " << ff_vtable_offset
|
||||
<< " to " << sf_vtable_offset << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Report about function type differences.
|
||||
if (type_diff() && type_diff()->to_be_reported())
|
||||
type_diff()->report(out, indent);
|
||||
|
@ -212,6 +212,11 @@ test-diff-dwarf/test27-local-base-diff-v1.o \
|
||||
test-diff-dwarf/test27-local-base-diff-v0.cc \
|
||||
test-diff-dwarf/test27-local-base-diff-v1.cc \
|
||||
test-diff-dwarf/test27-local-base-diff-report.txt \
|
||||
test-diff-dwarf/test28-vtable-changes-report-0.txt \
|
||||
test-diff-dwarf/test28-vtable-changes-v0.o \
|
||||
test-diff-dwarf/test28-vtable-changes-v1.o \
|
||||
test-diff-dwarf/test28-vtable-changes-v0.cc \
|
||||
test-diff-dwarf/test28-vtable-changes-v1.cc \
|
||||
\
|
||||
test-read-dwarf/test0 \
|
||||
test-read-dwarf/test0.abi \
|
||||
|
@ -0,0 +1,22 @@
|
||||
Functions changes summary: 0 Removed, 1 Changed, 2 Added functions
|
||||
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
|
||||
Function symbols changes summary: 0 Removed, 0 Added function symbol not referenced by debug info
|
||||
Variable symbols changes summary: 0 Removed, 3 Added function symbols not referenced by debug info
|
||||
|
||||
2 Added functions:
|
||||
|
||||
'method virtual S::~S(int)'
|
||||
'method virtual S::~S(int)'
|
||||
|
||||
1 function with some indirect sub-type change:
|
||||
|
||||
[C]'method void S::bar()' has some indirect sub-type changes:
|
||||
method void S::bar() is now declared virtual
|
||||
|
||||
|
||||
3 Added variable symbols not referenced by debug info:
|
||||
|
||||
_ZTI1S, aliases _ZTS1S
|
||||
_ZTS1S
|
||||
_ZTV1S, aliases _ZTI1S, _ZTS1S
|
||||
|
26
tests/data/test-diff-dwarf/test28-vtable-changes-v0.cc
Normal file
26
tests/data/test-diff-dwarf/test28-vtable-changes-v0.cc
Normal file
@ -0,0 +1,26 @@
|
||||
// Compile with:
|
||||
// g++ -g -Wall -c test28-vtable-changes-v0.cc
|
||||
|
||||
struct S
|
||||
{
|
||||
void
|
||||
bar();
|
||||
|
||||
virtual void
|
||||
baz();
|
||||
|
||||
virtual void
|
||||
foo();
|
||||
};
|
||||
|
||||
void
|
||||
S::bar()
|
||||
{}
|
||||
|
||||
void
|
||||
baz()
|
||||
{}
|
||||
|
||||
void
|
||||
foo()
|
||||
{}
|
BIN
tests/data/test-diff-dwarf/test28-vtable-changes-v0.o
Normal file
BIN
tests/data/test-diff-dwarf/test28-vtable-changes-v0.o
Normal file
Binary file not shown.
32
tests/data/test-diff-dwarf/test28-vtable-changes-v1.cc
Normal file
32
tests/data/test-diff-dwarf/test28-vtable-changes-v1.cc
Normal file
@ -0,0 +1,32 @@
|
||||
// Compile with:
|
||||
// g++ -g -Wall -c test28-vtable-changes-v1.cc
|
||||
|
||||
|
||||
struct S
|
||||
{
|
||||
virtual void
|
||||
bar();
|
||||
|
||||
virtual void
|
||||
baz();
|
||||
|
||||
virtual void
|
||||
foo();
|
||||
|
||||
virtual ~S();
|
||||
};
|
||||
|
||||
void
|
||||
S::bar()
|
||||
{}
|
||||
|
||||
void
|
||||
baz()
|
||||
{}
|
||||
|
||||
void
|
||||
foo()
|
||||
{}
|
||||
|
||||
S::~S()
|
||||
{}
|
BIN
tests/data/test-diff-dwarf/test28-vtable-changes-v1.o
Normal file
BIN
tests/data/test-diff-dwarf/test28-vtable-changes-v1.o
Normal file
Binary file not shown.
@ -230,6 +230,12 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-diff-dwarf/test27-local-base-diff-report.txt",
|
||||
"output/test-diff-dwarf/test27-local-base-diff-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-diff-dwarf/test28-vtable-changes-v0.o",
|
||||
"data/test-diff-dwarf/test28-vtable-changes-v1.o",
|
||||
"data/test-diff-dwarf/test28-vtable-changes-report-0.txt",
|
||||
"output/test-diff-dwarf/test28-vtable-changes-report-0.txt"
|
||||
},
|
||||
// This should be the last entry
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user