libabigail/include
Dodji Seketeli a07fce3669 ir: Introduce internal pretty representation for anonymous classes
There are two views for internal pretty representation of anonymous
classes.

1/ When we look at the anonymous class itself, we use its 'flat
representation' i.e:

    'class {int blah; char bleh;}'

2/ When we look at a pointer or a reference to the anonymous class we
use its generic anonymous internal name, i.e:

   '__anonymous_struct__*'

As a general rule, libabigail always use the keyword 'class' to prefix
the name of classes for internal purposes, independent from the fact
that the type is a struct or a class.  That is a pre-requisite to be
able to canonicalize classes and structs together.  In other words, if
a class and a struct are structurally equal, they are going to be
considered equivalent by the canonicalization process.

Currently however, in the view 1/ of the pretty representation of
anonymous classes, a struct and a class will have different
representations.  For instance, and empty anonymous struct would be
represented as 'struct {}', whereas an empty anonymous class would be
represented as 'class {}'.  This prevents these two be considered
equivalent by the canonicalization process.  This leads to spurious
change reports later down the road.

In the view 2/ we have a similar but different problem: the qualified
names of the anonymous classes are not taken into account when
representing pointer or references to said anonymous classes.  Only
their unqualified generic anonymous internal names are taken into
account in the representation.  This leads to pointers/references to
anonymous classes being wrongly considered equivalent even when they
belong to different namespaces.

This patch corrects the issues related to both views 1/ and 2/.  It
should make libabigail correctly consider some anonymous classes as
equivalent (view 1) and correctly consider pointers/references to
anonymous classes as different when they belong to different
namespaces (view 2).

A number of reference tests are adjusted accordingly.

	* include/abg-fwd.h (get_class_or_union_flat_representation):
	Introduce an "internal" parameter.
	* src/abg-ir.cc (get_class_or_union_flat_representation):
	Introduce an "internal" parameter.  In the flat representation of
	a class for internal purposes, always use the prefix "class" even
	if this is a struct.
	(get_type_name): To build an internal name for a
	reference or pointer to an anonymous type, consider the namespace
	name of said type.
	(equals): In the overload for decl_base, take the namespace name
	of anonymous decls into account when comparing them.
	({var_decl, union_decl}::get_pretty_representation): Adjust calls
	to get_class_or_union_flat_representation to pass a proper
	"internal" argument.
	* src/abg-default-reporter.cc (default_reporter::report): Adjust
	the call to get_class_or_union_flat_representation to pass an
	"internal" argument set to 'false'.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 13:53:15 +01:00
..
abg-comp-filter.h Support incomplete enums in core and diff code. 2020-07-08 16:59:56 +02:00
abg-comparison.h Remove unused is_reference_or_pointer_diff. 2020-07-27 15:26:04 +02:00
abg-config.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-corpus.h Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
abg-cxx-compat.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-diff-utils.h Eliminate non-ASCII characters. 2020-06-15 10:56:44 +02:00
abg-dwarf-reader.h Add --drop-undefined-syms to abidw. 2020-04-15 14:29:55 +02:00
abg-fwd.h ir: Introduce internal pretty representation for anonymous classes 2020-11-27 13:53:15 +01:00
abg-hash.h abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
abg-ini.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-interned-str.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-ir.h ir: Add equality op to array_type_def::subrange_type::bound_value 2020-11-13 09:19:40 +01:00
abg-libxml-utils.h Fix compilation with g++ 4.8.5 on el7 2020-05-04 13:07:24 +02:00
abg-libzip-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-reader.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-regex.h Add POSIX regex wrapper functions. 2020-05-11 18:30:44 +02:00
abg-reporter.h Bug 26309 - Wrong leaf reporting of changes to typedef underlying type 2020-09-15 08:51:58 +02:00
abg-sptr-utils.h Move libxml bits out of abg-sptr-utils.h. 2020-05-04 11:17:30 +02:00
abg-suppression.h Make set_drops_artifact_from_ir non-const. 2020-05-11 14:36:55 +02:00
abg-tools-utils.h abg-tools-utils: Fix comment 2020-10-23 10:07:57 +02:00
abg-traverse.h Pimpl-ify traversable_base and remove its unused traverse method 2020-07-27 17:50:50 +02:00
abg-version.h.in Add (undocumented) support for version suffixes 2020-01-09 17:06:31 +00:00
abg-viz-common.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-viz-dot.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-viz-svg.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-workers.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-writer.h abg-writer: Add support for stable hash type ids. 2020-06-16 10:13:01 +02:00
Makefile.am Move regex definitions to own files. 2020-05-04 11:15:23 +02:00