libabigail/tests/data/test-diff-dwarf/test31-vtable-changes-v1.cc
Dodji Seketeli 425f8a4ec4 Detect vtable changes from member function changes
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>
2015-08-29 16:23:17 +02:00

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()
{}