Commit Graph

8 Commits

Author SHA1 Message Date
Dodji Seketeli
b6c3e9ec0a Fix a missing new line in the reports
* src/abg-comparison.cc (represent(class_decl::method_decl_sptr,
	ostream&)): Add a missing new line.
	* tests/data/test-bidiff/test-struct1-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-15 11:32:21 +02:00
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
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
fa3815a9e6 Avoid comparing member types and class templates
* src/abg-comparison.h (compute_diff): For class_decl_sptr, do not
	compare member types and member class templates.  This adds a lots
	of noise that is not necessarily useful for now.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Update tests.
	* tests/data/test-bidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct1-report.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-21 17:02:13 +01:00
Dodji Seketeli
2c3dbbdb62 Fix the pretty representation for member functions
* src/abg-ir.cc (function_decl::get_pretty_representation): Fix
	this to properly display the representation of member functions.
	* tests/data/test-bidiff/test-enum0-report.txt: Update this.
	* tests/data/test-bidiff/test-enum1-report.txt: Likewise.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct1-report.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-11 16:17:50 +01:00
Dodji Seketeli
593629100f Fix typo in report
* src/abg-comparison.cc (reference_diff::report): Fix typo
	refereneced -> referenced.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-10 15:51:10 +01:00
Dodji Seketeli
9905d847d2 Support looking through decl-only classes and update diff reports
accordingly

	* include/abg-comparison.h (class diff_context): New class.
	(class diff::{ctxt_, reported_once_, currently_reporting_}): New
	data members.
	(diff::diff): Initialize the new data members above.
	(diff::{context, currently_reporting, reported_once}): New
	accessors.
	(compute_diff, var_diff::var_diff, pointer_diff::pointer_diff)
	(reference_diff::reference_diff, qualified_type_diff)
	(enum_diff:enum_diff, class_diff::class_diff)
	(scope_diff::scope_diff, function_decl_diff::function_decl_diff)
	(type_decl_diff::type_decl_diff, typedef_diff::typedef_diff)
	(translation_unit_diff::translation_unit_diff, corpus_diff::corpus_diff):
	Take an additional pointer to diff_context.
	* abg-comparison.cc (diff_context::{has_diff_for,
	has_diff_for_types, add_diff}): New methods.
	(try_to_diff, compute_diff_for_types, compute_diff_for_decls)
	(represent): Take an additional pointer to
	diff_context in argument.  In the later function, do not re-report
	a diff if it has already been reported, or if it's being reported
	already.
	(var_diff::var_diff, pointer_diff::pointer_diff)
	(reference_diff::reference_diff)
	(qualified_type_diff::qualified_type_diff, enum_diff::enum_diff)
	(class_diff::class_diff, scope_diff::scope_diff)
	(function_decl_diff::function_decl_diff, type_decl::type_decl)
	(typedef_diff::typedef_diff)
	(translation_unit_diff::translation_unit_diff)
	(corpus_diff::corpus_diff): Take an additional pointer to
	diff_context in argument.
	({pointer_diff, qualified_type_diff,
	reference_type_diff}::report): do not re-report a diff about the
	underlying type if it has already been reported, or if it's being
	reported already.
	(enum_diff::report): Fix this to properly use the populated lookup
	tables.
	(compute_diff): take an additional pointer to diff_context in
	argument. For the var_decl, pointer_diff reference_type_diff,
	qualified_type_diff enum_diff, scope_diff, function_decl_diff,
	type_decl_diff and typedef_diff overloads, do not re-build a diff
	object, if one exits already.  Otherwise, record the new diff
	object created so that it can be re-used later.
	(enum_diff::ensure_lookup_tables_populated): Fix logic to avoid
	one loop.
	(class_decl::priv::{deleted_member_functions_,
	inserted_member_functions_, changed_member_function_}): New
	members to support reporting about member functions changes.
	(class_decl::{lookup_tables_empty, clear_lookup_tables, length):
	Update for the new additions above.
	(class_decl::ensure_lookup_tables_populated): Likewise.  Fix to
	properly use the lookup tables and also avoid a going through
	several loops to compute the changed members.
	(class_decl::report): Flip a switch to make the beginning and end
	of the reporting, in the context.  Also, do not try to report
	again, if we were already reporting this diff.  Fix quite some
	spots to properly use the lookup tables.
	(scope_diff::ensure_lookup_tables_populated): Skip decl-only
	classes during comparison. Fix some thinkos.  Fix logic to avoid a
	loop.
	(scope_diff::report): Adjust to pass a context to
	compute_diff_for_types.
	(function_decl_diff::ensure_lookup_tables_populated): Fix logic to
	avoid a loop.
	(function_decl_diff::report): Adjust call to
	compute_diff_for_types to pass the context.
	(typedef::report): Avoid re-reporting the diff of the underlying
	types, if we are already reporting it.
	(corpus_diff::priv::ensure_lookup_tables_populated): Use the
	pretty representation of the function rather than its name to key
	the maps of deleted and added functions. Fix logic to avoid going
	through an additional loop for the changed functions.
	(corpus_diff::report): Add a title for removed/added/changed
	functions.  Fix indentation for added/removed/changed functions.
	* include/abg-ir.h (class_decl::comparison_started_): New member
	* src/abg-dwarf-reader.cc (is_public_decl): Style fix.
	(is_declaration_only_): New static function.
	(build_class_type_and_add_to_ir): Create decl-only classes (IR) for
	classes flagged as declaration-only in the DWARF.
	* src/abg-hash.cc (class_decl:#️⃣:operator()): Do not forget to
	include the "is_declaration_only" flag into the hashing.
	* src/abg-ir.cc (class_decl::operator==): Look through decl-only
	classes to get their definitions and compare the definitions
	instead.  Avoid comparing member types and fns if the comparison
	of this type has already started.
	* src/abg-reader.cc (build_class_decl): Set the definition of a
	declaration, when we see it.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Update.
	* tests/data/test-bidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct1-report.txt: Likewise.

signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-10 15:51:10 +01:00
Dodji Seketeli
c5b81de47d Add support for bidiff regression testing
* tests/data/test-bidiff/test-enum0-v0.cc.bi: New input file.
	* tests/data/test-bidiff/test-enum0-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-enum0-report.diff: Likewise.
	* tests/data/test-bidiff/test-enum1-v0.cc.bi: Likewise.
	* tests/data/test-bidiff/test-enum1-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-enum1-report.txt: Likewise.
	* tests/data/test-bidiff/test-qual-type0-v0.cc.bi: Likewise.
	* tests/data/test-bidiff/test-qual-type0-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct0-v0.cc.bi: Likewise.
	* tests/data/test-bidiff/test-struct0-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct1-v0.cc.bi: Likewise.
	* tests/data/test-bidiff/test-struct1-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-struct1-report.txt: Likewise.
	* tests/data/test-bidiff/test-var0-v0.cc.bi: Likewise.
	* tests/data/test-bidiff/test-var0-v1.cc.bi: Likewise.
	* tests/data/test-bidiff/test-var0-report.txt: Likewise.
	* tests/test-bidiff.cc: New file.
	* tests/Makefile.am: Build the new runtestbidiff regression test
	and add the above to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-29 14:32:30 +01:00