libabigail/include
Dodji Seketeli 11c2437a19 Better detect when diff nodes only carry local type changes
For some fine grain redundancy filtering, we need to know when a diff
node carries *only* a basic type change.  This is because basic type
changes should not be marked as redundant; we want to see all of them
-- unlike for class or union (user defined) type changes.

And so to know if a diff node carries only a basic type change, we
need to know if a diff node only carries a local type change.  If it
carries only a type change, we can safely just look at that type
change and see if it's a basic type change or not.

So, we then need to know what kind of local changes a diff node
carries: type change or non-type change.  That way, we can analyze the
local changes a node carries and infer that it only carries a local
type change or if it also carries a non-type change.

This patch thus changes the diff::has_local_changes() pure virtual member
function to make it return the enum change_kind bitmask, which
describes the different kinds of local changes the diff node has.

Note that two new bit values were added to that enum:
LOCAL_TYPE_CHANGE_KIND and LOCAL_NON_TYPE_CHANGE_KIND.  The first one
says that the diff node carries a local type change, while the second
one says that the diff node carries a local non-type change kind.

The various implementations of that interface are thus amended to make
them return the right bitmask.  To do this, the patch updates the
various 'equals' overloads to make them return the proper enum
change_kind bitmap with the LOCAL_TYPE_CHANGE_KIND and
LOCAL_NON_TYPE_CHANGE_KIND set, if need be.

	* include/abg-comparison.h ({diff, type_diff_base, decl_diff_base,
	distinct_diff, var_diff, pointer_diff, reference_diff, array_diff,
	qualified_type, enum_diff, class_or_union_diff, class_diff,
	base_diff, scope_diff, fn_parm_diff, function_type_diff,
	function_decl_diff, typedef_diff,
	translation_unit_diff}::has_local_changes): Return an enum
	change_kind, rather than just a bool.
	(is_diff_of_basic_type): Declare an overload that takes a boolean
	flag.
	(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
	(peel_qualified_type, peel_pointer_or_qualified_type): Declare new
	functions
	* include/abg-fwd.h (peel_qualified_type):
	* include/abg-ir.h (enum change_kind::{LOCAL_TYPE_CHANGE_KIND,
	LOCAL_NON_TYPE_CHANGE_KIND, ALL_LOCAL_CHANGES_MASK}): Add these
	three new enumerators.
	* src/abg-comparison.cc ({distinct_diff, var_diff, pointer_diff,
	array_diff, reference_diff, qualified_type_diff, enum_diff,
	class_or_union_diff, class_diff, base_diff, scope_diff,
	fn_parm_diff, function_type_diff, function_decl_diff,
	type_decl_diff, typedef_diff,
	translation_unit_diff}::has_local_changes): Adjust to return an
	enum change_kind, rather than just a bool.
	(has_local_type_change_only): Define new functions.
	(has_basic_type_change_only): Use the new
	has_local_type_change_only function and the new overload for
	is_diff_of_basic_type.
	(is_diff_of_basic_type): Define an overload that takes a boolean
	flag.
	(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
	(peel_qualified_type, peel_pointer_or_qualified_type): Define new
	functions.
	* src/abg-ir.cc (equals): In the overloads for decl_base,
	scope_decl, type_base, qualified_type_diff, pointer_type_def,
	reference_type_def, array_type_def, enum_type_decl, typedef_decl,
	var_decl, function_type, function_decl, function_decl::parameter,
	class_or_union, class_decl::base_spec and class_decl, properly set
	the new abigail::ir::{LOCAL_CHANGE_KIND,
	LOCAL_NON_TYPE_CHANGE_KIND, LOCAL_TYPE_CHANGE_KIND} bits.
	(types_have_similar_structure): Peel qualified types and typedefs
	off, first thing.
	(peel_qualified_or_typedef_type): Define new function.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
	Adjust.
	* tests/data/test-diff-filter/libtest45-basic-type-change-report-{0,1}.txt:
	New reference test reports.
	* tests/data/test-diff-filter/libtest45-basic-type-change-v{0,1}.so:
	New input test binaries.
	* tests/data/test-diff-filter/test45-basic-type-change-v{0,1}.cc:
	Source code of the input test binaries above.
	* tests/data/Makefile.am: Add the new test file above to source
	distribution.
	* tests/test-diff-filter.cc: Add the test input above to the test
	harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-05-24 16:04:44 +02:00
..
abg-comp-filter.h Do not mark "distinct" diff nodes as being redundant 2018-04-13 11:10:30 +02:00
abg-comparison.h Better detect when diff nodes only carry local type changes 2018-05-24 16:04:44 +02:00
abg-config.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-corpus.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-diff-utils.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-dwarf-reader.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-fwd.h Better detect when diff nodes only carry local type changes 2018-05-24 16:04:44 +02:00
abg-hash.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-ini.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-interned-str.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-ir.h Better detect when diff nodes only carry local type changes 2018-05-24 16:04:44 +02:00
abg-libxml-utils.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-libzip-utils.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-reader.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-reporter.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-sptr-utils.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-suppression.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-tools-utils.h Rename misleading remove_trailing_white_spaces functions 2018-04-16 13:57:27 +02:00
abg-traverse.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-version.h.in Add --version option to several libabigail tools 2015-11-16 12:54:10 +01:00
abg-viz-common.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-viz-dot.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-viz-svg.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-workers.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
abg-writer.h Update copyright notice for all source files 2018-01-08 18:24:26 +01:00
Makefile.am Allow several kinds of reports to be emitted 2017-10-06 12:33:50 +02:00