Commit Graph

427 Commits

Author SHA1 Message Date
Dodji Seketeli
bf52d83bfe Consider added/removed data members as changing size or offset
* src/abg-comp-filter.cc (data_member_added_or_removed): New
	static function.
	(harmless_filter::visit): Re-organize logic.  Categorize data
	member addition/removal into SIZE_OR_OFFSET_CHANGE_CATEGORY.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-10 15:07:24 +02:00
Dodji Seketeli
ff78ffab6a Add missing comment
* src/abg-ir.cc (non_type_tparameter::get_hash): Add missing api doc.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-10 09:18:06 +02:00
Dodji Seketeli
d25c8bbbaa Fix and add missing hashing through the virtual decl_base::get_hash
* include/abg-ir.h (struct {scope_decl, non_type_tparameter,
	type_composition, class_decl}::hash): Declare hashers.
	({scope_decl, var_decl, non_type_tparameter, type_composition,
	class_decl}::get_hash): Provide new overloads of the get_hash.
	* src/abg-hash.cc ({type_decl, scope_type_decl,
	qualified_type_def, pointer_type_def, reference_type_def,
	enum_type_decl, typedef_decl, var_decl,
	function_decl}:#️⃣:operator()): If the hash is being
	calculated, do not use the not-yet fully calculated hash value.
	Rather, calculate the hash, cache it and return the value.
	({class_decl, non_type_tparameter}:#️⃣:operator()): Moved the
	{class_decl, non_type_tparameter}::hash declaration out of here
	and stick it in include/abg-ir.h.  Keep the definition of the
	hashing operators here though.
	(type_composition:#️⃣:operator()): New operator definition.
	* src/abg-ir.cc ({scope_decl, var_decl, class_decl,
	non_type_tparameter, type_composition}::get_hash): Define new
	virtual overload.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-09 17:11:32 +02:00
Dodji Seketeli
793be5e374 Fix mis-hashing of base specifiers and function_decl during comparison
* include/abg-ir.h (function_decl::get_hash): Declare new virtual
	overload.
	* src/abg-hash.cc (class_decl::base_spec:#️⃣:operator()):
	Properly hash the base specifier so that it doesn't collide with
	hashing a class.
	* src/abg-ir.cc (decl_base::get_hash): Abort if we detect a
	missing overload for this;
	(function_decl::get_hash() const): Implement this missing
	overload, allowing using the virtual decl_base::get_hash for
	function_decl.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 15:56:18 +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
30a301220d Drive-by indentation fix
* src/abg-dwarf-reader.cc (build_ir_node_from_die): Fix
	indentation.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 13:30:27 +02:00
Dodji Seketeli
ff712fe3fc Drop ABI artifacts that are local to a function
* src/abg-dwarf-reader.cc (get_scope_for_die): If the parent die
	is  DW_TAG_subprogram then just drop the whole thing on the floor.
	(build_ir_node_from_die): When the scope is NULL, just drop the
	whole thing on the floor.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 13:23:25 +02:00
Dodji Seketeli
8ac24228b0 Fix the static data member recognition hack
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
	When trying to recognize the global var_decl as being definition
	variables for static data members, lookup the declaration for the
	data member in the relevant class.  If found, then just flag the
	var_decl for the data member as being static; no need to add a
	var_decl as data member in that case, that would duplicate the
	data member.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 13:14:52 +02:00
Dodji Seketeli
25509e06cb Fix looking up a node inside a class
* src/abg-ir.cc (lookup_node_in_scope): Do not forget to actually
	look at the class members.  Sigh.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-08 12:04:54 +02:00
Dodji Seketeli
7639b2d3ab Work around old dwarf producers forgetting mangled names for functions
* src/abg-comparison.cc
	(corpus_diff::priv::ensure_lookup_tables_populated): If lookup
	using mangled name for a deleted function yields nada, try the
	lookup with the pretty representation for the function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-07 13:52:40 +02:00
Dodji Seketeli
435f1520d7 Make type_base::get_{size,alignment}_in_bits virtual
* include/abg-ir.h (type_base::get_{size,alignment}_in_bits): Make
	this virtual.
	(typedef_decl::get_{size,alignment}_in_bits): Add new member
	functions.  Get the size,alignment from the underlying type and
	update the current size/alignment if they differ.  Keep in mind
	that the size of an underlying class_decl can change over its
	lifetime, given how the dwarf reader reads the type information,
	i.e, there can be a DIE for a class type with no size information
	that will lead to the creation of a class_decl with size zero.
	Later during the DWARF reading process, another DIE will
	supplement the type information, adding size information to that
	class_decl.  In between, a typedef_decl might have been created
	with the first version of the class_decl that has a zero size.  I
	guess this should be extended to the other type constructs that
	have an underlying type (qualified types, references and pointers).

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-07 10:08:10 +02:00
Dodji Seketeli
ce1df6ff33 Look through typedefs when setting SIZE_OR_OFFSET_CHANGE_CATEGORY
* include/abg-fwd.h (is_class_type): Declare new functions.
	* src/abg-comp-filter.cc (harmful_filter::visit): Use the above to
	convert a type into a class.
	* src/abg-ir.cc (is_class_type): Define the new function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-07 09:54:52 +02:00
Dodji Seketeli
23b7fa9ac2 Add a new DECL_NAME_CHANGE_CATEGORY change category
* include/abg-comparison.h (enum
	diff_category::DECL_NAME_CHANGE_CATEGORY): New enumerator.
	* src/abg-comparison.cc (report_name_size_and_alignment_changes)
	({enum, typedef}_diff::report): Adjust to avoid emitting name
	change report if the DECL_NAME_CHANGE_CATEGORY category of change
	is currently disallowed.
	* abg-comp-filter.cc (decl_name_changed): New static function.
	(harmless_filter::visit): Detect that the decl name changed and
	put the current diff node (and its parents) into the
	DECL_NAME_CHANGE_CATEGORY category.
	* tools/bidiff.cc (set_diff_context_from_opts): Set the new
	DECL_NAME_CHANGE_CATEGORY category into the harmless_changes group
	of categories.
	* tests/data/test-diff-filter/test6-report.txt: New test input file.
	* tests/data/test-diff-filter/test6-v0.cc: Likewise.
	* tests/data/test-diff-filter/test6-v0.o: Likewise.
	* tests/data/test-diff-filter/test6-v1.cc: Likewise.
	* tests/data/test-diff-filter/test6-v1.o: Likewise.
	* tests/data/test-diff-filter/test7-report.txt: Likewise.
	* tests/data/test-diff-filter/test7-v0.cc: Likewise.
	* tests/data/test-diff-filter/test7-v0.o: Likewise.
	* tests/data/test-diff-filter/test7-v1.cc: Likewise.
	* tests/data/test-diff-filter/test7-v1.o: Likewise.
	* tests/test-diff-filter.cc: Take the new inputs above to run new tests.
	* tests/Makefile.am: Add the new files above to the distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-06 15:59:38 +02:00
Dodji Seketeli
928efb2d4f Emit qualified name for typedefs
* src/abg-comparison.cc (typedef_diff::report): Emit qualified
	names for typedefs in diff reports about typedef name changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-05 13:03:20 +02:00
Dodji Seketeli
17c804e565 Fix indentation in distinct type diff report
* src/abg-comparison.cc (distinct_diff::report): Do not forget to
	change line.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-05 13:02:01 +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
08acaa1c84 Slight run-by fixes
* src/abg-comparison.cc
	(corpus_diff::priv::apply_filters_and_compute_diff_stats)
	(corpus_diff::report): Use compute_diff for types which it has an
	overload rather than going through the compute_diff_for_decls that
	would use dynamic casting.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-04 15:21:46 +02:00
Dodji Seketeli
e9ce9ef352 Do not hook type diff nodes to a parent
A given diff node for a type can be hung off of several contexts: a
function parameter type node, another type diff node, etc.  For that
reason, a type diff node should not have a parent node.  Thus, it's
should be the job of the context containing the type diff node to
propagate its categories to the context nodes.  This actually fixes a bug
about category propagation.

	* abg/comparison.cc (var_diff::var_diff): Do not set parent node
	for the type diff of the var_diff.
	(var_diff::traverse): Handle category propagation from the
	type diff node to the var_diff node.
	(pointer_diff::underlying_type_diff)
	(reference_diff::underlying_type_diff)
	(qualified_type_diff::underlying_type_diff, enum_diff::enum_diff)
	(base_diff::get_underlying_class_diff)
	(typedef_diff::underlying_type_diff): Do not set the parent node
	here.
	({pointer_diff, reference_diff, qualified_type, enum_diff,
	class_diff, base_diff, function_decl_diff,
	typedef_diff}::traverse): Handle category propagation here.
	* tests/data/test-diff-filter/test4-v0.o: New input binary.
	* tests/data/test-diff-filter/test4-v0.cc: Source code for the
	input binary above.
	* tests/data/test-diff-filter/test4-v1.o: New input binary.
	* tests/data/test-diff-filter/test4-v1.cc: Source code for the
	input binary above.
	* tests/data/test-diff-filter/test4-report.txt: Reference diff
	report for the input binaries above.
	* tests/test-diff-filter.cc:: Run bidiff --no-harmless on the
	binaries above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-04 14:44:50 +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
27df878b59 Remove useless white space
* src/abg-ir.cc (look_through_decl_only_class): Remove useless
	white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-03 09:20:00 +02:00
Dodji Seketeli
dd346bab80 Use mangled name for decl comparison when it's present
* src/abg-ir.cc (decl_base::operator==(const decl_base& other)
	const): Use the mangled name of the decl in priority.
	* src/abg-hash.cc (struct decl_base:#️⃣:operator()): Likewise.
	* src/abg-comparison.cc (function_decl_diff::report): Do not
	report a function name change if it doesn't involve a mangled name
	change.  This might change when we start dealing with templates.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-03 09:18:52 +02:00
Dodji Seketeli
b386b28eb4 A change involving a decl-only class is not SIZE_OR_OFFSET_CHANGE_CATEGORY
* src/abg-comp-filter.cc (harmful_filter::visit): If a size change
	involves a decl-only class, it certainly shouldn't trigger putting
	the sub-tree into the SIZE_OR_OFFSET_CHANGE_CATEGORY category.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-02 17:58:54 +02:00
Dodji Seketeli
42473515bc Fix heuristics to detect function static-ness for DWARF < 3
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Make
	the heuristics work for functions with no parameters.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-02 17:56:55 +02:00
Dodji Seketeli
5652802eef Avoid emitting local filtered-out changes in more spots
* src/abg-comparison.cc (maybe_report_diff_for_member): Take the
	diff_context in parameter.  Use that to check if local changes of
	category ACCESS_CHANGE_CATEGORY are filtered-out and do not report
	the change in that case.
	({var_diff, enum_diff, class_diff, base_diff,
	function_decl_diff}::report): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-02 17:31:06 +02:00
Dodji Seketeli
64bbb5ccef Add a COMPATIBLE_TYPE_CHANGE_CATEGORY to bidiff --no-harmless
* include/abg-comparison.h
	(diff_category::COMPATIBLE_TYPE_CHANGE_CATEGORY): New enumerator.
	(operator|=(diff_category&, diff_category)): New declaration.
	* include/abg-fwd.h (is_typedef, strip_typedef)
	(types_are_compatible): New declarations.
	* include/abg-ir.h (operator==(const decl_base_sptr, const
	decl_base_sptr)): Added the consts here.
	(operator==(const type_base_sptr, const type_base_sptr)): New
	declaration.
	* src/abg-comp-filter.cc (is_compatible_change): New static
	function.
	(harmless_filter::visit): Detect compatible changes and add the
	sub-tree into the new COMPATIBLE_TYPE_CHANGE_CATEGORY if
	applicable. Cleanup the logic.
	* src/abg-comparison.cc (operator|=(diff_category&,
	diff_category)): Define new function.
	(operator==(const decl_base_sptr l, const decl_base_sptr r)): Add
	consts.
	(operator==(const type_base_sptr l, const type_base_sptr r)):
	Define new operator.
	(is_typedef, strip_typedef, types_are_compatible): New function
	definitions.
	* tests/data/test-diff-filter/test3-report.txt: New test report
	reference.
	* tests/data/test-diff-filter/test3-v0.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test3-v0.o: New test input.
	* tests/data/test-diff-filter/test3-v1.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test3-v1.o: New test input.
	* tests/test-diff-filter.cc: Adjust to consume the new tests
	inputs above.
	* tools/bidiff.cc: Add the new COMPATIBLE_TYPE_CHANGE_CATEGORY
	into the --harmless group.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-02 17:23:56 +02:00
Dodji Seketeli
28304c9439 Don't emit local filtered-out changes
* src/abg-comparison.cc (represent): For var_decl, do not emit
	filtered-out local size/offset/access changes.
	(report_name_size_and_alignment_changes): Take the diff context.
	Do not report filtered-out local size/offset changes.
	({var_diff, enum_diff, class_diff, type_decl_diff}::report):
	Adjust.
	* test0-report.txt: Adjust.
	* test01-report.txt: New reference report for the same inputs
	test0-v{1,0}.o, but called without the --no-harmless command line.
	* tests/data/test-diff-filter/test2-v0.cc: Source code for new test input.
	* tests/data/test-diff-filter/test2-v1.cc: Likewise.
	* tests/data/test-diff-filter/test2-v0.o: New test input.
	* tests/data/test-diff-filter/test2-v1.o: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Reference report
	for new test input.
	* tests/test-diff-filter.cc: Consume the test inputs above.
	* tests/Makefile.am: Add the new test inputs above to the
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-04-01 16:08:30 +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
847c9e8166 Fix thinko class_diff traversing.
* src/abg-comparison.cc (class_diff::traverse): Fix thinking in
	introduced by commit "6709478 Fix infinite loop when traversing
	classes and their members"
	* tests/data/test-diff-filter/test1-v{0,1}.o: New test binary input files.
	* tests/data/test-diff-filter/test1-v{0,1}.cc: Source code for the
	above.
	* tests/data/test-diff-filter/test1-report.txt: Reference report
	for the diffing of the two binary input files above.
	* tests/test-diff-filter.cc: Make the test run on the new input above.
	* tests/Makefile.am: Add the new material to the distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 13:17:28 +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
a8d5284442 Fix diff report indentation issue
* abg-comparison.cc (corpus_diff::report): Indent the details of
	function changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 11:23:50 +02:00
Dodji Seketeli
6709478816 Fix infinite loop when traversing classes and their members
* src/abg-comparison.cc (TRY_{PRE,POST}_VISIT_CLASS_DIFF): New
	macros.
	(class_diff::priv::traversing_): New flag.
	(class_diff::priv::priv): New constructor to initialize the new
	flag above.
	(class_diff::traversing): Do not traverse the diff again if it's
	being traversed already.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 09:39:49 +02:00
Dodji Seketeli
0951fd93ea Fix access_changed and data_member_offset_changed predicates
* src/abg-comp-filter.cc (access_changed)
	(data_member_offset_changed): Fix detection of membership.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-31 09:38:11 +02:00
Dodji Seketeli
67e6971005 Take filtering in account in diff stats & better categorizing
* include/abg-comparison.h
	(diff_category::ACCESS_CHANGE_CATEGORY): Renamed
	ACCESS_CHANGED_CATEGORY into this.
	(diff_category::SIZE_OR_OFFSET_CHANGE_CATEGORY): Renamed
	SIZE_CHANGED_CATEGORY into this.  Changed its semantics to
	incorporate offset changes as well.
	* src/abg-comparison.cc (struct noop_deleter): Move this up.
	(represent): Do not report filtered out data members.
	(report_mem_header): Add a new num_filtered parameter to take
	filtered-out members in account in members report headers.
	Adjust.
	(class_diff::priv::{count_filtered_bases,
	count_filtered_data_members, count_filtered_member_functions}):
	New member functions.  When a member is filtered, do not report
	it all.
	({enum_diff, class_diff}::report): Adjust.  Take filtered members
	into account in headers.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats): New
	member function.
	(corpus_diff::priv::emit_diff_stats): Renamed
	emit_corpus_diff_stats into this.  Change it to take the stats in
	parameter.
	(corpus_diff::report): Adjust to re-use the above.  Filter
	varibles as well.  Take the filtered functions & variables in
	account in the stats.  Do not report filtered-out functions &
	variables at all.
	* src/abg-comp-filter.cc (type_size_changed, access_changed)
	(data_member_offset_changed): New predicates.
	({harmless, harmful}_filter::visit): Adjust to use the new
	predicates above.  Update the harmful variant for the new
	SIZE_OR_OFFSET_CHANGE_CATEGORY category.
	* tools/bidiff.cc (set_diff_context_from_opts): Adjust for the
	categories name changes.
	* tests/data/test-diff-filter/test0-report.txt: New test input.
	* tests/data/test-diff-filter/test0-v0.cc: Likewise.
	* tests/data/test-diff-filter/test0-v0.o: Likewise.
	* tests/data/test-diff-filter/test0-v1.cc: Likewise.
	* tests/data/test-diff-filter/test0-v1.o: Likewise.
	* tests/test-diff-filter.cc: New test harness.
	* tests/Makefile.am: Add the new test files above to the
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-29 10:26:45 +01: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
9291712259 Fix typos in the test-diff-dwarf.cc source code
* tests/test-diff-dwarf.cc: Fix various typos.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-29 09:58:08 +01:00
Dodji Seketeli
802f7cbc92 Initial implementation of diff tree node filtering
* include/abg-comp-filter.h: New file.
	* include/Makefile.am: Add the new include/abg-comp-filter.h to
	the source distribution.
	* include/abg-comparison.h (enum visiting_kind, diff_category): New enums.
	(operator|): Declare new operator declaration for the new
	visiting_kind enum.
	(operator{|,^,&,~}): Declare new operator decl for the new
	diff_category enum.
	(diff_context::{get_allowed_category, set_allowed_category,
	switch_categories_on, switch_categories_off, diff_filters,
	add_diff_filter, maybe_apply_filters}): Declare new member functions.
	(diff::{parent_, category_}): New members.
	(diff::diff): Adjust.
	(diff::{get_parent, set_parent, get_category, add_to_category,
	is_filtered_out, to_be_reported}):  New members.
	(diff_node_visitor::{get_visiting_kind, set_visiting_kind}): New
	members.
	(diff_node_visitor::visit): Add a new flag to saying if the
	visitor is being called in post or pre children traversing mode.
	* src/abg-comparison.cc (operator|): Declare new operator
	declaration for the new visiting_kind enum.
	(operator{|,^,&,~}): Declare new operator decl for the new
	diff_category enum.
	(diff_context::priv::{allowed_category_, filters_}): New members.
	(diff_context::diff_context): Add all known filters.
	(diff_context::{get_allowed_category, set_allowed_category,
	switch_categories_on, switch_categories_off, diff_filters,
	add_diff_filter, maybe_apply_filters}): Define new member
	functions.
	(diff::{is_filtered_out, to_be_reported}): Define new members.
	(*::report): Use the new diff::to_be_reported function.
	(*::traverse): Adjust for pre/post visiting.
	(var_diff::var_diff): Chain the type diff node to its parent.
	({pointer_diff, reference_diff, qualified_type_diff,
	typedef_diff}::underlying_type_diff): Chain the underlying type
	diff node to its parent.
	(enum_diff::enum_diff): Likewise.
	(base_diff::underlying_class_diff): Likewise.
	({class_diff, corpus_diff}::report): Do not report changed
	(member) functions that have been filtered out.  Rather report
	that they have been filtered out.
	({function_decl_diff, class_diff}::traverse): Chain underlying
	type diff nodes to their parent.
	(diff_node_visitor::visit): Add a new flag to saying if the
	visitor is being called in post or pre children traversing mode.
	Make sure to call the default diff::visit overload.
	* src/abg-comp-filter.cc: New file.
	* src/Makefile.am: Add the new abg-comp-filter.cc to the source
	distribution.
	* tools/bidiff.cc (options::show_harm{ful,less}_changes): New
	members.
	(display_usage): Add usage strings for --no-harmless and
	--no-harmful options.
	(parse_command_line): Parse --no-harmless and --no-harmful command
	line options.
	(set_diff_context_from_opts): Populate the diff context
	accordingly.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +01:00
Dodji Seketeli
d2ffdbffca Add missing headers double inclusion guards
* include/abg-comparison.h: Add a missing double inclusion guard.
	* include/abg-diff-utils.h: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:18 +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
7eecfa8a0c Fixlets in the bidiff regression testing harness
* tests/test-bidiff.cc (main): Fix a typo.  Fix the path to the
	output path.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +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
Dodji Seketeli
29036c19ce Rename test-walker.cc into test-ir-walker.cc
* tests/test-ir-walker.cc: Renamed test-walker.cc into this.
	* tests/Makefile.am: Adjust.  The generated binary is now testirwalker.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00
Dodji Seketeli
9186de3dec Initial diff tree traversal infrastructure
* include/abg-comparison.h (struct diff_traversable_base, struct
	diff_node_visitor): New type.
	(class diff): Extends the new diff_traversable_base.
	({diff, distinct_diff, var_diff, pointer_diff, reference_diff,
	qualified_type_diff, enum_diff, class_diff, base_diff, scope_diff,
	function_decl_diff, type_decl_diff, typedef_diff,
	translation_unit_diff, corpus_diff}::traverse): New methods.
	(function_decl_diff::return_type_diff): New accessor.  Renamed
	return_diff into this.
	(translation_unit_diff::{first, second}_translation_unit): New
	accessors.
	(corpus_diff::{deleted, added, changed}_functions): New accessors.
	* src/abg-comparison.cc ({distinct_diff, var_diff,
	pointer_diff, reference_diff, qualified_type_diff, enum_diff,
	class_diff, base_diff, scope_diff, function_decl_diff,
	type_decl_diff, typedef_diff, translation_unit_diff,
	corpus_diff}::traverse): New function implementations.
	(maybe_report_diff_for_member): Renamed
	maybe_report_diff_for_class_members into this.
	(var_diff::report): Adjust.
	(struct translation_unit_diff::priv): New private type.
	(translation_unit_diff::translation_unit_diff): Instantiate the
	new priv_ member.
	(translation_unit_diff::{first,second}_translation_unit): New
	accessors.
	(corpus_diff::{deleted, added, changed}_functions): New function
	implementations.
	(diff_node_visitor::visit): New function implementations.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00
Dodji Seketeli
88741744e7 Make tree walking preemptive
* include/abg-traverse.h (traversable_base::traversable): Change
	the signature of this to return a boolean.
	* include/abg-ir.h (ir_traversable_base::traverse): Change the
	signature of this to return a boolean.
	(*::traverse): Adjust.
	(ir_node_visitor::visit): Change the signature of this to return a
	boolean.
	* src/abg-corpus.cc (symtab_build_visitor_type::visit): Adjust.
	* src/abg-ir.cc (::traverse): Adjust.
	* tests/test-walker.cc (name_printing_visitor::visit): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-27 13:01:17 +01:00
Jonathan Wakely
12b78c366d Fix comment typos
* include/abg-diff-utils.h (compute_diff): Fix typo in apidoc
	comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-26 15:06:32 +01:00
Dodji Seketeli
04a1e27258 Follow DW_AT_abstract_origin and add missing mangled name
* src/abg-dwarf-reader.cc (build_function_decl): Change signature
	to take function_decl to which one shall add properties that got
	added by subsequent DIEs later.
	(build_class_type_and_add_to_ir): Adjust.
	(build_function_decl): Allow adding new properties to an existing
	function_decl.  Add the mangled name in particular.
	* tests/data/test-read-dwarf/test1.abi: Update test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-24 12:22:05 +01:00