diff options
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 1cd2bf596f8..5aea55e792f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -946,6 +946,16 @@ cp_build_qualified_type_real (tree type, return result; } +/* Return TYPE with const and volatile removed. */ + +tree +cv_unqualified (tree type) +{ + int quals = TYPE_QUALS (type); + quals &= ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE); + return cp_build_qualified_type (type, quals); +} + /* Builds a qualified variant of T that is not a typedef variant. E.g. consider the following declarations: typedef const int ConstInt; @@ -1040,6 +1050,10 @@ strip_typedefs (tree t) else result = build_function_type (type, arg_types); + + if (TYPE_RAISES_EXCEPTIONS (t)) + result = build_exception_variant (result, + TYPE_RAISES_EXCEPTIONS (t)); } break; default: @@ -1048,6 +1062,8 @@ strip_typedefs (tree t) if (!result) result = TYPE_MAIN_VARIANT (t); + if (TYPE_ATTRIBUTES (t)) + result = cp_build_type_attribute_variant (result, TYPE_ATTRIBUTES (t)); return cp_build_qualified_type (result, cp_type_quals (t)); } @@ -1284,6 +1300,8 @@ build_qualified_name (tree type, tree scope, tree name, bool template_p) return error_mark_node; t = build2 (SCOPE_REF, type, scope, name); QUALIFIED_NAME_IS_TEMPLATE (t) = template_p; + if (type) + t = convert_from_reference (t); return t; } @@ -2079,6 +2097,8 @@ cp_tree_equal (tree t1, tree t2) case TEMPLATE_PARM_INDEX: return (TEMPLATE_PARM_IDX (t1) == TEMPLATE_PARM_IDX (t2) && TEMPLATE_PARM_LEVEL (t1) == TEMPLATE_PARM_LEVEL (t2) + && (TEMPLATE_PARM_PARAMETER_PACK (t1) + == TEMPLATE_PARM_PARAMETER_PACK (t2)) && same_type_p (TREE_TYPE (TEMPLATE_PARM_DECL (t1)), TREE_TYPE (TEMPLATE_PARM_DECL (t2)))); @@ -2595,7 +2615,8 @@ cp_build_type_attribute_variant (tree type, tree attributes) tree new_type; new_type = build_type_attribute_variant (type, attributes); - if (TREE_CODE (new_type) == FUNCTION_TYPE + if ((TREE_CODE (new_type) == FUNCTION_TYPE + || TREE_CODE (new_type) == METHOD_TYPE) && (TYPE_RAISES_EXCEPTIONS (new_type) != TYPE_RAISES_EXCEPTIONS (type))) new_type = build_exception_variant (new_type, @@ -3127,6 +3148,17 @@ cp_free_lang_data (tree t) DECL_EXTERNAL (t) = 1; TREE_STATIC (t) = 0; } + if (CP_AGGREGATE_TYPE_P (t) + && TYPE_NAME (t)) + { + tree name = TYPE_NAME (t); + if (TREE_CODE (name) == TYPE_DECL) + name = DECL_NAME (name); + /* Drop anonymous names. */ + if (name != NULL_TREE + && ANON_AGGRNAME_P (name)) + TYPE_NAME (t) = NULL_TREE; + } } |