Commit Graph

15 Commits

Author SHA1 Message Date
Dodji Seketeli
0112c5619a Don't compare non-virtual member functions in class comparison
* src/abg-comparison.cc
	(class_diff::ensure_lookup_tables_populated): Use the virtual
	member functions here, not the member functions in general.
	(compute_diff): Consider virtual member functions only, not
	non-virtual ones.
	* src/abg-ir.cc (class_decl::operator==): Do not compare
	non-virtual member functions.  Only compare virtual member
	functions.
	* tests/data/test-bidiff/test-struct1-report.txt: New test input.
	* tests/data/test-diff-dwarf/test0-report.txt: New test input.
	* tests/data/test-diff-filter/test0-report.txt: New test input.
	* tests/data/test-diff-filter/test01-report.txt: New test input.
	* tests/data/test-diff-filter/test10-report.txt: New test input.
	* tests/data/test-diff-filter/test11-report.txt: New test input.
	* tests/data/test-diff-filter/test2-report.txt: New test input.
	* tests/data/test-diff-filter/test9-report.txt: New test input.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-14 21:48:00 +02:00
Dodji Seketeli
f02768e7a7 Represent a removed+added data member at a given offset as changed
* include/abg-fwd.h (get_data_member_offset): Declare new overload for
	decl_base_sptr.
	* include/abg-comparison.h (unsigned_decl_base_sptr_map)
	(unsigned_changed_type_or_decl_map): New typedefs.
	* src/abg-ir.cc (get_data_member_offset): Define new overload for decl_base_sptr.
	* src/abg-comparison.cc (diff_kind::subtype_change_kind): New
	enumerator for a change about a type or sub-type of a member of a
	structure/enum.
	(report_mem_header): Handle the new enumerator above.
	(class_diff::priv::{deleted_dm_by_offset_, inserted_dm_by_offset_,
	changed_dm_}): New data members.
	(class_diff::priv::subtype_changed_dm_): Renamed
	class_diff::priv::changed_data_members_ into this.
	(class_diff::priv::subtype_changed_dm): Renamed
	class_diff::priv::data_member_has_changed into this. Adjust.
	(class_diff::count_filtered_subtype_changed_dm): Renamed
	count_filtered_data_members into this.  Adjust.
	(class_diff::priv::count_filtered_changed_dm): New member
	function.
	(class_diff::lookup_tables_empty): Adjust.
	(class_diff::ensure_lookup_tables_populated): Adjust.  Detect when
	a data member is deleted and added back to offset N, and be
	prepared to present that as a change of data member at offset N.
	(class_diff::report): Adjust.  Report data members of a given
	offset that have changed.
	* tests/data/test-diff-dwarf/test6-report.txt: New reference
	report for new test input.
	* tests/data/test-diff-dwarf/test6-v0.cc: Source code for new test
	input binary.
	* tests/data/test-diff-dwarf/test6-v0.o: New test input binary.
	* tests/data/test-diff-dwarf/test6-v1.cc: Source code for new test
	input binary.
	* tests/data/test-diff-dwarf/test6-v1.o: New test input binary.
	* tests/test-diff-dwarf.cc: Adjust to include the new test inputs above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-11 21:55:08 +02:00
Dodji Seketeli
dce487d39c Properly place opening quote and add missing closing quote in report
* src/abg-comparison.cc (corpus_diff::report): Move the [{A,D}]
	marker before the opening quote.  And add a closing quote.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 15:08:06 +02:00
Dodji Seketeli
96edc0b08c Really compare return types for function types
* src/abg-ir.cc (compare_function_types): Compare return types,
	unless this is a method and the return type is the same type as
	the containing class type.
	* tests/data/test-diff-dwarf/test5-report.txt: Reference report
	for the comparison of the two input binaries below.
	* tests/data/test-diff-dwarf/test5-v0.cc: Source code for the
	input binary below.
	* tests/data/test-diff-dwarf/test5-v0.o: Test input binary.
	* tests/data/test-diff-dwarf/test5-v1.cc: Source code for the
	input binary below.
	* tests/data/test-diff-dwarf/test5-v1.o: Test input binary.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-05 12:42:24 +02:00
Dodji Seketeli
2c03fdda8a Add missing tests for previous commits
* tests/data/test-diff-dwarf/test4-report.txt: Adjust.
	* tests/test-diff-dwarf.cc: Run tests for
	data/test-diff-dwarf/test3-report.txt" and
	data/test-diff-dwarf/test4-report.txt.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-05 12:40:28 +02:00
Dodji Seketeli
8801da4eb9 Categorize through compatible distinct type diffs
* src/abg-comparison.cc (report_size_and_alignment_changes): Split
	this static function out of ...
	(report_name_size_and_alignment_changes): ... this one.
	(distinct_diff::report): If the typedef-stripped variants of the
	diff subjects are of the same kind, display their diff.
	Otherwise, tell explicitly is the distinct type diff involves a
	type size change.
	(distinct_diff::traverse): If the typedef-stripped variants of the
	diff subjects are of the same kind, traverse that underlying diff
	sub-tree and propagate the categorizing possibly resulting from
	that traversal.
	* tests/data/test-diff-dwarf/test4-v0.o: New test input binary.
	* tests/data/test-diff-dwarf/test4-v0.cc: Source code for the
	input binary above.
	* tests/data/test-diff-dwarf/test4-v1.o: New test input binary.
	* tests/data/test-diff-dwarf/test4-v1.cc: Source code for the
	input binary above.
	* tests/data/test-diff-dwarf/test4-report.txt: Reference report
	for the difference between the two binaries above.
	* tests/data/test-diff-filter/test5-v0.o: New test input binary.
	* tests/data/test-diff-filter/test5-v0.cc: Source code for the
	input binary above.
	* tests/data/test-diff-filter/test5-v1.o: New test input binary.
	* tests/data/test-diff-filter/test5-v1.cc: Source code for the
	input binary above.
	* tests/data/test-diff-filter/test5-report.txt: Reference report
	for the difference between the two binaries above.
	* tests/test-diff-filter.cc: Adjust to produce a filtered diff for
	the two input binaries above.
	* tests/Makefile.am: Adjust to add missing test files to the
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-05 12:24:25 +02:00
Dodji Seketeli
6a57f61497 Fix off-by one comparison bug in comparing function parameters
* src/abg-comparison.cc
	(function_decl_diff::ensure_lookup_tables_populated): Function
	parameters that are diff'ed start at the first non-implicit
	parameter, not at the first parameter.  Oops.
	* tests/data/test-diff-dwarf/test3-v0.o: New test input binary.
	* tests/data/test-diff-dwarf/test3-v0.cc: Source code for the
	binary above.
	* tests/data/test-diff-dwarf/test3-v1.o: New test input binary.
	* tests/data/test-diff-dwarf/test3-v1.cc: Source code for the
	binary above.
	* tests/data/test-diff-dwarf/test3-report.txt: Reference report
	for the diff of the new test inputs.
	* tests/test-diff-dwarf.cc: Use the test inputs above to run new
	tests.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-04 11:39:41 +02:00
Dodji Seketeli
712320ab4c Do not forget parm sub-type changes as opposed to parm changes
* src/abg-comparison.cc
	(function_decl_diff::ensure_lookup_tables_populated): A parm
	change is valid only when the added parm has a different name from
	the removed parm.  Both have the same index, of course.  In that
	case, do not try to remove the corresponding parm sub-type change.
	* tests/data/test-bidiff/test-enum0-report.txt: Adjust.
	* tests/data/test-bidiff/test-enum1-report.txt: Adjust.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Adjust.
	* tests/data/test-bidiff/test-struct0-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test1-report.txt: Adjust.
	* tests/data/test-diff-filter/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test1-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test3-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-03 16:52:14 +02:00
Dodji Seketeli
70d5afdaa2 Compact & intuitive reporting for changed function parameters
* include/abg-comparison.h (unsigned_changed_parm_map)
	(unsigned_parm_map): New typedefs.
	* src/abg-comparison.cc
	(function_decl_diff::subtype_changed_parms): Renamed this from
	changed_parms.
	(function_decl_diff::priv::subtype_changed_parms_}): Renamed this
	from changed_parms_;
	(function_decl_diff::priv::{deleted_parms_by_id_,
	added_parms_by_id_, changed_parms_by_id_}): New members.
	(function_decl_diff::ensure_lookup_tables_populated): Update the
	new priv::changed_parms_by_id_ member to contain the parameters
	that got changed, as opposed to the subtype_changed_parms_ member
	that contain parameters that got a sub-type change.  The other
	priv::*_by_id_ members are helpers for this.  Update them too.
	(function_decl_diff::subtype_changed_parms): Renamed this from
	::changed_parms.
	(function_decl_diff::report): Report separately about parameters
	having a sub-type change, and parameters that got changed.  Note
	that in both cases, the change is necessarily to a compatible
	type.
	* data/test-diff-dwarf/test2-v0.cc: New test file.
	* data/test-diff-dwarf/test2-v0.o: Likewise.
	* data/test-diff-dwarf/test2-v1.cc: Likewise.
	* data/test-diff-dwarf/test2-v1.o: Likewise.
	* data/test-diff-dwarf/test2-report.txt: Likewise.
	* tests/Makefile.am: Add the new test files above to the
	distribution.
	* tests/test-diff-dwarf.cc: Consume the input files above to
	actually perform a regression test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-01 12:38:51 +02:00
Dodji Seketeli
33be9938be Add forgotten test output adjustment
* tests/data/test-diff-filter/test0-report.txt: Adjust for the
	commit "a8d5284 Fix diff report indentation issue"
	* tests/data/test-diff-dwarf/test{0,1}-report.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 13:17:00 +02:00
Dodji Seketeli
b53edd3fcd Add forgotten source file for binary test input
* tests/data/test-diff-dwarf/test1-v0.cc: New file.
	* tests/data/test-diff-dwarf/test1-v1.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 11:27:32 +02:00
Dodji Seketeli
e55a7e3397 Fix var_diff length determination
* src/abg-comparison.cc (var_diff::length):  Just compare the two
	diff subjects.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-29 10:26:45 +01:00
Dodji Seketeli
ec53393fb1 Add a missing apostrophe to access reporting
* src/abg-comparison.cc (represent): For member var_decls, add a
	missing apostrophe after the access.
	* tests/data/test-diff-dwarf/test0-report.txt: Update test report.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +01:00
Dodji Seketeli
ec6d70500d Fix diff emptiness detection for function_decl_diff nodes
* src/abg-comparison.cc (function_decl_diff::length): Just compare
	the two functions here, damit.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +01:00
Dodji Seketeli
fcd2ef9d4e Initial regression test for dwarf diffing
* tests/test-diff-dwarf.cc: New dwarf diffing regression test
	harness.
	* tests/data/test-diff-dwarf/test0-report.txt: New test input.
	* tests/data/test-diff-dwarf/test0-v0.cc: Likewise.
	* tests/data/test-diff-dwarf/test0-v0.o: Likewise.
	* tests/data/test-diff-dwarf/test0-v1.cc: Likewise.
	* tests/data/test-diff-dwarf/test0-v1.o: Likewise.
	* tests/Makefile.am: Add the new test inputs from
	tests/test-diff-dwarf.cc and tests/data/test-diff-dwarf/* to
	the build system.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00