Use type_hash_eq langhook in check_qualified_type.
gcc/ * tree.c (check_lang_type): New. (check_qualified_type): Use it. (check_aligned_type): Use it. * tree.h: Declare it. gcc/cp/ * tree.c (cp_check_qualified_type): Call check_base_type instead of check_qualified_type. (cxx_type_hash_eq): Check ref-qualifiers. * typeck.c (apply_memfn_quals): No need to mess with TYPE_CANONICAL. From-SVN: r241831
This commit is contained in:
parent
b302001e3a
commit
1906d6b4dc
@ -1,3 +1,10 @@
|
||||
2016-11-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* tree.c (check_lang_type): New.
|
||||
(check_qualified_type): Use it.
|
||||
(check_aligned_type): Use it.
|
||||
* tree.h: Declare it.
|
||||
|
||||
2016-11-03 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
* config.gcc (arm-wrs-vxworks): Set target_cpu_cname.
|
||||
|
@ -1,3 +1,10 @@
|
||||
2016-11-03 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* tree.c (cp_check_qualified_type): Call check_base_type instead
|
||||
of check_qualified_type.
|
||||
(cxx_type_hash_eq): Check ref-qualifiers.
|
||||
* typeck.c (apply_memfn_quals): No need to mess with TYPE_CANONICAL.
|
||||
|
||||
2016-11-01 Jason Merrill <jason@redhat.com>
|
||||
|
||||
Implement P0136R1, Rewording inheriting constructors.
|
||||
|
@ -1980,7 +1980,8 @@ static bool
|
||||
cp_check_qualified_type (const_tree cand, const_tree base, int type_quals,
|
||||
cp_ref_qualifier rqual, tree raises)
|
||||
{
|
||||
return (check_qualified_type (cand, base, type_quals)
|
||||
return (TYPE_QUALS (cand) == type_quals
|
||||
&& check_base_type (cand, base)
|
||||
&& comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (cand),
|
||||
ce_exact)
|
||||
&& type_memfn_rqual (cand) == rqual);
|
||||
@ -4080,9 +4081,7 @@ cp_build_type_attribute_variant (tree type, tree attributes)
|
||||
}
|
||||
|
||||
/* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
|
||||
Called only after doing all language independent checks. Only
|
||||
to check TYPE_RAISES_EXCEPTIONS for FUNCTION_TYPE, the rest is already
|
||||
compared in type_hash_eq. */
|
||||
Called only after doing all language independent checks. */
|
||||
|
||||
bool
|
||||
cxx_type_hash_eq (const_tree typea, const_tree typeb)
|
||||
@ -4090,6 +4089,8 @@ cxx_type_hash_eq (const_tree typea, const_tree typeb)
|
||||
gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE
|
||||
|| TREE_CODE (typea) == METHOD_TYPE);
|
||||
|
||||
if (type_memfn_rqual (typea) != type_memfn_rqual (typeb))
|
||||
return false;
|
||||
return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
|
||||
TYPE_RAISES_EXCEPTIONS (typeb), ce_exact);
|
||||
}
|
||||
|
@ -9227,13 +9227,6 @@ apply_memfn_quals (tree type, cp_cv_quals memfn_quals, cp_ref_qualifier rqual)
|
||||
/* This should really have a different TYPE_MAIN_VARIANT, but that gets
|
||||
complex. */
|
||||
tree result = build_qualified_type (type, memfn_quals);
|
||||
if (tree canon = TYPE_CANONICAL (result))
|
||||
if (canon != result)
|
||||
/* check_qualified_type doesn't check the ref-qualifier, so make sure
|
||||
TYPE_CANONICAL is correct. */
|
||||
TYPE_CANONICAL (result)
|
||||
= build_ref_qualified_type (canon, type_memfn_rqual (result));
|
||||
result = build_exception_variant (result, TYPE_RAISES_EXCEPTIONS (type));
|
||||
return build_ref_qualified_type (result, rqual);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ struct lang_hooks_for_types
|
||||
/* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
|
||||
Called only after doing all language independent checks.
|
||||
At present, this function is only called when both TYPE1 and TYPE2 are
|
||||
FUNCTION_TYPEs. */
|
||||
FUNCTION_TYPE or METHOD_TYPE. */
|
||||
bool (*type_hash_eq) (const_tree, const_tree);
|
||||
|
||||
/* Return TRUE if TYPE uses a hidden descriptor and fills in information
|
||||
|
21
gcc/tree.c
21
gcc/tree.c
@ -6497,6 +6497,21 @@ set_type_quals (tree type, int type_quals)
|
||||
TYPE_ADDR_SPACE (type) = DECODE_QUAL_ADDR_SPACE (type_quals);
|
||||
}
|
||||
|
||||
/* Returns true iff CAND and BASE have equivalent language-specific
|
||||
qualifiers. */
|
||||
|
||||
bool
|
||||
check_lang_type (const_tree cand, const_tree base)
|
||||
{
|
||||
if (lang_hooks.types.type_hash_eq == NULL)
|
||||
return true;
|
||||
/* type_hash_eq currently only applies to these types. */
|
||||
if (TREE_CODE (cand) != FUNCTION_TYPE
|
||||
&& TREE_CODE (cand) != METHOD_TYPE)
|
||||
return true;
|
||||
return lang_hooks.types.type_hash_eq (cand, base);
|
||||
}
|
||||
|
||||
/* Returns true iff unqualified CAND and BASE are equivalent. */
|
||||
|
||||
bool
|
||||
@ -6517,7 +6532,8 @@ bool
|
||||
check_qualified_type (const_tree cand, const_tree base, int type_quals)
|
||||
{
|
||||
return (TYPE_QUALS (cand) == type_quals
|
||||
&& check_base_type (cand, base));
|
||||
&& check_base_type (cand, base)
|
||||
&& check_lang_type (cand, base));
|
||||
}
|
||||
|
||||
/* Returns true iff CAND is equivalent to BASE with ALIGN. */
|
||||
@ -6532,7 +6548,8 @@ check_aligned_type (const_tree cand, const_tree base, unsigned int align)
|
||||
/* Check alignment. */
|
||||
&& TYPE_ALIGN (cand) == align
|
||||
&& attribute_list_equal (TYPE_ATTRIBUTES (cand),
|
||||
TYPE_ATTRIBUTES (base)));
|
||||
TYPE_ATTRIBUTES (base))
|
||||
&& check_lang_type (cand, base));
|
||||
}
|
||||
|
||||
/* This function checks to see if TYPE matches the size one of the built-in
|
||||
|
@ -4214,6 +4214,11 @@ extern tree merge_dllimport_decl_attributes (tree, tree);
|
||||
/* Handle a "dllimport" or "dllexport" attribute. */
|
||||
extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
|
||||
|
||||
/* Returns true iff CAND and BASE have equivalent language-specific
|
||||
qualifiers. */
|
||||
|
||||
extern bool check_lang_type (const_tree cand, const_tree base);
|
||||
|
||||
/* Returns true iff unqualified CAND and BASE are equivalent. */
|
||||
|
||||
extern bool check_base_type (const_tree cand, const_tree base);
|
||||
|
Loading…
Reference in New Issue
Block a user