Make canonicalization non sensitive to struct-ness of subtypes
authorDodji Seketeli <dodji@redhat.com>
Wed, 14 Oct 2015 20:40:18 +0000 (22:40 +0200)
committerDodji Seketeli <dodji@redhat.com>
Thu, 15 Oct 2015 11:50:48 +0000 (13:50 +0200)
commit4b754229d1588558968423e6031dfada12d2c38a
treec9403827e0fc1134bfebf39448e952a47747bb85
parentf1c48fe80f9305427e5a2cc4e9fd6edc518a373b
Make canonicalization non sensitive to struct-ness of subtypes

In a previous patch, we made canonicalization independant from
struct-ness of class types.  This was in this commit:

    0e3416e Bug 19023 - Type canonicalization is sensitive to struct-ness

But then, that didn't handle the case of composite types which have a
subtype of class type T, where the same T was declared as "struct" and
as "class" in the same binary.

This patch handles that case by passing a flag to the functions that
build the pretty representation of types.  Note that the pretty
representation is used as a key in the hash map that contains
canonical types.  That flag is passed all the way down to the function
that builds the pretty representation for class types, which decides
to use either "struct" or "class" as a previx for the representation.

The type canonicalization code then passes that flag (properly set) to
the pretty representation function.

* include/abg-fwd.h (get_type_name, get_function_type_name)
(get_method_type_name, get_pretty_representation): Add an
"internal" flag to all overoads.
* include/abg-ir.h
({type_or_decl_base, decl_base, type_decl, scope_type_decl,
qualified_type_def, array_type_def, enum_type_decl, typedef_decl,
var_decl, function_decl, function_decl::parameter, function_type,
method_type, class_decl}::get_pretty_representation): Add an
'internal' flag.
({decl_base, qualified_type_def, pointer_type_def,
reference_type_def, array_type_def, enum_type_decl::enumerator,
function_decl::parameter}::get_qualified_name): Likewise.
(qualified_type_def::build_name): Likewise.
* src/abg-ir.cc ({decl_base, qualified_type_def, pointer_type_def,
reference_type_def, array_type_def, enum_type_decl,
enum_type_decl::enumerator,
function_decl::parameter}::get_qualified_name): Take an "internal"
flag.
(qualified_type_def::build_name): Likewise.
({decl_base, type_decl, namespace_decl, array_type_def,
enum_type_decl, typedef_decl, var_decl, function_type,
method_type, function_decl,
class_decl}::get_pretty_representation): Likewise.
(get_type_name, get_function_type_name, get_method_type_name)
(get_pretty_representation): Likewise.
(type_base::get_canonical_type_for): Call
get_pretty_representation() with the "internal" flag set to
"true", to get a pretty representation that is independant from
the struct-ness of the subtypes of the type being canonicalized.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-fwd.h
include/abg-ir.h
src/abg-ir.cc