aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-11-03 15:52:58 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-11-03 15:52:58 -0400
commit1906d6b4dc4cf6bddb82e9dc3534438230030a8e (patch)
treebba16b05930156885aa3e5b7fb63e4b7cfd29e1f /gcc/tree.c
parentb302001e3a04e8d2911989816c8907bf3e5c2389 (diff)
downloadgcc-1906d6b4dc4cf6bddb82e9dc3534438230030a8e.zip
gcc-1906d6b4dc4cf6bddb82e9dc3534438230030a8e.tar.gz
gcc-1906d6b4dc4cf6bddb82e9dc3534438230030a8e.tar.bz2
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 56cc653..434aff1 100644
--- a/gcc/tree.c
+++ b/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