diff options
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r-- | gcc/cp/mangle.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index e8259521adb..a47dfa8babf 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -346,11 +346,19 @@ canonicalize_for_substitution (tree node) if (TYPE_P (node) && TYPE_CANONICAL (node) != node && TYPE_MAIN_VARIANT (node) != node) + { /* Here we want to strip the topmost typedef only. We need to do that so is_std_substitution can do proper name matching. */ - node = cp_build_qualified_type (TYPE_MAIN_VARIANT (node), - cp_type_quals (node)); + if (TREE_CODE (node) == FUNCTION_TYPE) + /* Use build_qualified_type and TYPE_QUALS here to preserve + the old buggy mangling of attribute noreturn with abi<5. */ + node = build_qualified_type (TYPE_MAIN_VARIANT (node), + TYPE_QUALS (node)); + else + node = cp_build_qualified_type (TYPE_MAIN_VARIANT (node), + cp_type_quals (node)); + } return node; } @@ -1281,7 +1289,7 @@ nested_anon_class_index (tree type) { int index = 0; tree member = TYPE_FIELDS (TYPE_CONTEXT (type)); - for (; member; member = TREE_CHAIN (member)) + for (; member; member = DECL_CHAIN (member)) if (DECL_IMPLICIT_TYPEDEF_P (member)) { tree memtype = TREE_TYPE (member); @@ -1711,7 +1719,7 @@ write_local_name (tree function, const tree local_entity, { tree t; int i = 0; - for (t = DECL_ARGUMENTS (function); t; t = TREE_CHAIN (t)) + for (t = DECL_ARGUMENTS (function); t; t = DECL_CHAIN (t)) { if (t == parm) i = 1; @@ -1776,6 +1784,7 @@ write_type (tree type) if (type == error_mark_node) return; + type = canonicalize_for_substitution (type); if (find_substitution (type)) return; @@ -1978,6 +1987,12 @@ write_CV_qualifiers_for_type (const tree type) array. */ cp_cv_quals quals = TYPE_QUALS (type); + /* Attribute const/noreturn are not reflected in mangling. */ + if (abi_version_at_least (5) + && (TREE_CODE (type) == FUNCTION_TYPE + || TREE_CODE (type) == METHOD_TYPE)) + return 0; + if (quals & TYPE_QUAL_RESTRICT) { write_char ('r'); @@ -2288,12 +2303,12 @@ write_method_parms (tree parm_types, const int method_p, const tree decl) if (method_p) { parm_types = TREE_CHAIN (parm_types); - parm_decl = parm_decl ? TREE_CHAIN (parm_decl) : NULL_TREE; + parm_decl = parm_decl ? DECL_CHAIN (parm_decl) : NULL_TREE; while (parm_decl && DECL_ARTIFICIAL (parm_decl)) { parm_types = TREE_CHAIN (parm_types); - parm_decl = TREE_CHAIN (parm_decl); + parm_decl = DECL_CHAIN (parm_decl); } } |