mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-22 01:40:12 +00:00
425f8a4ec4
This patch adds vtable changes detection based on the detection of virtual member function changes. That is, when a member function changes, if that member function is virtual, then infer if the change implies changes to the vtable of the containing class. Before that patch, we were doing the vtable change detection when we were comparing two classes; we were then comparing their virtual member functions. But as for a given class all its virtual member functions are not necessarily emitted in the DWARF debug info (only the virtual member functions that are used in a given translation unit are emitted in that translation unit) it's not reliable to compare virtual member functions as part of comparing a given class. We thus decided some patches ago to stop comparing virtual member functions when we compare two classes. So with this patch now, we still detect changes to the vtable and emit an appropriate message to the user. * include/abg-ir.h (class_decl::{has_virtual_base, has_vtable}): Declare new member functions. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): New overload for function_decl_diff. (has_virtual_mem_fn_change): In the overload for diff*, support virtual member function changes detection for function_decl_diff*. * src/abg-comparison.cc (function_decl_diff::report): Detect and report changes to a vtable by looking a changes that can happen to a given member function. (corpus_diff::report): Detect and report changes to vtables by looking at changes change to member functions. * tests/data/test-diff-dwarf/test29-vtable-changes-report-0.txt: New text input. * tests/data/test-diff-dwarf/test29-vtable-changes-v{0,1}.cc: Source code of new test input binaries. * tests/data/test-diff-dwarf/test29-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt: New text input. * tests/data/test-diff-dwarf/test30-vtable-changes-v{0,1}.cc: New test input. * tests/data/test-diff-dwarf/test30-vtable-changes-v{0,1}.o: New test input binaries. * tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt: New test input. * tests/data/test-diff-dwarf/test31-vtable-changes-v{0,1}.cc: Source code of new test input binary. * tests/data/test-diff-dwarf/test31-vtable-changes-v{0,1}.o: New test input binary. * tests/data/Makefile.am: Add the new test input files above to source distribution. * tests/test-diff-dwarf.cc (in_out_specs): Consume the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
16 lines
154 B
C++
16 lines
154 B
C++
// Compile this with :
|
|
// gcc -g -Wall -c test31-vtable-changes-v1.cc
|
|
|
|
struct S
|
|
{
|
|
virtual ~S();
|
|
virtual void fn1();
|
|
};
|
|
|
|
S::~S()
|
|
{}
|
|
|
|
void
|
|
S::fn1()
|
|
{}
|