Fix canonicalizing of member types ... *AGAIN*

So abidiff libabigail.so libabigail.so is broken again.  Sigh.

It was broken by this wrong commit:

    commit 5b33223cb7
    Author: Dodji Seketeli <dodji@redhat.com>
    Date:   Fri Feb 20 13:48:48 2015 +0100

	Simplify canonicalizing handling for typedefs

	    * src/abg-dwarf-reader.cc (build_ir_node_from_die): For typedefs,
	    we don't need to test that the current scope is a class to know
	    that we are looking at a member type.  Just looking at the
	    is_member flag is enough.

So the issue arises when for instance, we are reading a class that
defines a member typedef (or enum) and uses that enum as the type of a
data member.  When reading that data member (before reading the
definition of the typedef), we read the type of the data member; so we
hit the typedef.  But build_ir_node_from_die() cannot fully construct
the scope of the typedef before handing off the typedef because we are
currently building it!  So it hands out a non-complete version of the
class that is being built;  'is_member' is not set to 'true' because
we are getting the type of the data member; it's not *necessarily* a
member type.  So we need to check !is_class_type(scope) to know if we
are given a member type.  I am now thinking that the "is_member" flag
is actually useless.  I think I'll remove it in a later patch.

Anyway, this fixes 'abidiff libabigail.so libabigail.so' again.  I
have some stashed patches that brings it's time down to ~ 45 seconds.
So we are getting close to being able to include that *ultimate* test in
regression test suite.  Oh well.

	* src/abg-dwarf-reader.cc (build_ir_node_from_die): When building
	typedefs, enum and memeber classes, check that the scope is a
	member class to detect if we are building a member type.  In which
	case the caller is going to handle the canonicalizing of the
	member type *after* it's access specification has been adjusted.
	Otherwise, that adjustments happens after the type has been
	canonicalized and bad things happen at comparison type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-02-22 22:25:33 +01:00
parent 56d958641c
commit 69d6c26828
1 changed files with 3 additions and 3 deletions

View File

@ -7168,7 +7168,7 @@ build_ir_node_from_die(read_context& ctxt,
called_from_public_decl,
where_offset);
result = add_decl_to_scope(t, scope);
if (t && !is_member_type)
if (t && !is_member_type && !is_class_type(scope))
maybe_canonicalize_type(dwarf_dieoffset(die),
die_is_from_alt_di,
ctxt);
@ -7235,7 +7235,7 @@ build_ir_node_from_die(read_context& ctxt,
enum_type_decl_sptr e = build_enum_type(ctxt,
die_is_from_alt_di,
die);
if (e && !is_member_type)
if (e && !is_member_type && !is_class_type(scope))
{
result = add_decl_to_scope(e, scope);
maybe_canonicalize_type(dwarf_dieoffset(die),
@ -7290,7 +7290,7 @@ build_ir_node_from_die(read_context& ctxt,
result = klass;
// For klass to be eligible for canonicalization at this
// point, it needs to be a non-member type.
if (!is_member_type)
if (!is_member_type && !is_class_type(scope))
{
// To be early canonicalized here, klass needs:
if (// NOT be an incomplete type that is being currently