diff options
Diffstat (limited to 'contrib/gcc/cp/mangle.c')
-rw-r--r-- | contrib/gcc/cp/mangle.c | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/contrib/gcc/cp/mangle.c b/contrib/gcc/cp/mangle.c index 00e5143..2e79581 100644 --- a/contrib/gcc/cp/mangle.c +++ b/contrib/gcc/cp/mangle.c @@ -1353,6 +1353,11 @@ write_type (type) since both the qualified and uqualified types are substitution candidates. */ write_type (TYPE_MAIN_VARIANT (type)); + else if (TREE_CODE (type) == ARRAY_TYPE) + /* It is important not to use the TYPE_MAIN_VARIANT of TYPE here + so that the cv-qualification of the element type is available + in write_array_type. */ + write_array_type (type); else { /* See through any typedefs. */ @@ -1399,10 +1404,6 @@ write_type (type) write_nested_name (TYPE_STUB_DECL (type)); break; - case ARRAY_TYPE: - write_array_type (type); - break; - case POINTER_TYPE: /* A pointer-to-member variable is represented by a POINTER_TYPE to an OFFSET_TYPE, so check for this first. */ @@ -1469,19 +1470,23 @@ write_CV_qualifiers_for_type (type) "In cases where multiple order-insensitive qualifiers are present, they should be ordered 'K' (closest to the base type), - 'V', 'r', and 'U' (farthest from the base type) ..." */ + 'V', 'r', and 'U' (farthest from the base type) ..." - if (CP_TYPE_RESTRICT_P (type)) + Note that we do not use cp_type_quals below; given "const + int[3]", the "const" is emitted with the "int", not with the + array. */ + + if (TYPE_QUALS (type) & TYPE_QUAL_RESTRICT) { write_char ('r'); ++num_qualifiers; } - if (CP_TYPE_VOLATILE_P (type)) + if (TYPE_QUALS (type) & TYPE_QUAL_VOLATILE) { write_char ('V'); ++num_qualifiers; } - if (CP_TYPE_CONST_P (type)) + if (TYPE_QUALS (type) & TYPE_QUAL_CONST) { write_char ('K'); ++num_qualifiers; @@ -1506,8 +1511,8 @@ write_CV_qualifiers_for_type (type) ::= m # unsigned long ::= x # long long, __int64 ::= y # unsigned long long, __int64 - ::= n # __int128 [not supported] - ::= o # unsigned __int128 [not supported] + ::= n # __int128 + ::= o # unsigned __int128 ::= f # float ::= d # double ::= e # long double, __float80 @@ -1552,15 +1557,23 @@ write_builtin_type (type) write_char (integer_type_codes[itk]); break; } - + if (itk == itk_none) { tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type)); if (type == t) - /* Couldn't find this type. */ - abort (); - type = t; - goto iagain; + { + if (TYPE_PRECISION (type) == 128) + write_char (TREE_UNSIGNED (type) ? 'o' : 'n'); + else + /* Couldn't find this type. */ + abort (); + } + else + { + type = t; + goto iagain; + } } } break; @@ -1595,6 +1608,17 @@ write_function_type (type) { MANGLE_TRACE_TREE ("function-type", type); + /* For a pointer to member function, the function type may have + cv-qualifiers, indicating the quals for the artificial 'this' + parameter. */ + if (TREE_CODE (type) == METHOD_TYPE) + { + /* The first parameter must be a POINTER_TYPE pointing to the + `this' parameter. */ + tree this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (type))); + write_CV_qualifiers_for_type (this_type); + } + write_char ('F'); /* We don't track whether or not a type is `extern "C"'. Note that you can have an `extern "C"' function that does not have @@ -1769,6 +1793,16 @@ write_expression (expr) code = TREE_CODE (expr); } + /* Skip NOP_EXPRs. They can occur when (say) a pointer argument + is converted (via qualification conversions) to another + type. */ + while (TREE_CODE (expr) == NOP_EXPR + || TREE_CODE (expr) == NON_LVALUE_EXPR) + { + expr = TREE_OPERAND (expr, 0); + code = TREE_CODE (expr); + } + /* Handle template parameters. */ if (code == TEMPLATE_TYPE_PARM || code == TEMPLATE_TEMPLATE_PARM @@ -1788,15 +1822,6 @@ write_expression (expr) { int i; - /* Skip NOP_EXPRs. They can occur when (say) a pointer argument - is converted (via qualification conversions) to another - type. */ - while (TREE_CODE (expr) == NOP_EXPR) - { - expr = TREE_OPERAND (expr, 0); - code = TREE_CODE (expr); - } - /* When we bind a variable or function to a non-type template argument with reference type, we create an ADDR_EXPR to show the fact that the entity's address has been taken. But, we @@ -2021,24 +2046,7 @@ write_pointer_to_member_type (type) tree type; { write_char ('M'); - /* For a pointer-to-function member, the class type may be - cv-qualified, but that won't be reflected in - TYPE_PTRMEM_CLASS_TYPE. So, we go fishing around in - TYPE_PTRMEM_POINTED_TO_TYPE instead. */ - if (TYPE_PTRMEMFUNC_P (type)) - { - tree fn_type; - tree this_type; - - fn_type = TYPE_PTRMEM_POINTED_TO_TYPE (type); - /* The first parameter must be a POINTER_TYPE pointing to the - `this' parameter. */ - this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fn_type))); - write_type (this_type); - } - /* For a pointer-to-data member, things are simpler. */ - else - write_type (TYPE_PTRMEM_CLASS_TYPE (type)); + write_type (TYPE_PTRMEM_CLASS_TYPE (type)); write_type (TYPE_PTRMEM_POINTED_TO_TYPE (type)); } |