static int write_CV_qualifiers_for_type PARAMS ((tree));
static void write_builtin_type PARAMS ((tree));
static void write_function_type PARAMS ((tree));
-static void write_bare_function_type PARAMS ((tree, int));
-static void write_method_parms PARAMS ((tree, int));
+static void write_bare_function_type PARAMS ((tree, int, tree));
+static void write_method_parms PARAMS ((tree, int, tree));
static void write_class_enum_type PARAMS ((tree));
static void write_template_args PARAMS ((tree));
static void write_expression PARAMS ((tree));
(!DECL_CONSTRUCTOR_P (decl)
&& !DECL_DESTRUCTOR_P (decl)
&& !DECL_CONV_FN_P (decl)
- && decl_is_template_id (decl, NULL)));
+ && decl_is_template_id (decl, NULL)),
+ decl);
}
}
extern "C" function_t f; // Vice versa.
See [dcl.link]. */
- write_bare_function_type (type, /*include_return_type_p=*/1);
+ write_bare_function_type (type, /*include_return_type_p=*/1,
+ /*decl=*/NULL);
write_char ('E');
}
-/* Non-terminal <bare-function-type>. NODE is a FUNCTION_DECL or a
+/* Non-terminal <bare-function-type>. TYPE is a FUNCTION_TYPE or
METHOD_TYPE. If INCLUDE_RETURN_TYPE is non-zero, the return value
- is mangled before the parameter types.
+ is mangled before the parameter types. If non-NULL, DECL is
+ FUNCTION_DECL for the function whose type is being emitted.
<bare-function-type> ::= </signature/ type>+ */
static void
-write_bare_function_type (type, include_return_type_p)
+write_bare_function_type (type, include_return_type_p, decl)
tree type;
int include_return_type_p;
+ tree decl;
{
MANGLE_TRACE_TREE ("bare-function-type", type);
/* Now mangle the types of the arguments. */
write_method_parms (TYPE_ARG_TYPES (type),
- TREE_CODE (type) == METHOD_TYPE);
+ TREE_CODE (type) == METHOD_TYPE,
+ decl);
}
/* Write the mangled representation of a method parameter list of
- types given in PARM_LIST. If METHOD_P is non-zero, the function is
- considered a non-static method, and the this parameter is omitted. */
+ types given in PARM_TYPES. If METHOD_P is non-zero, the function is
+ considered a non-static method, and the this parameter is omitted.
+ If non-NULL, DECL is the FUNCTION_DECL for the function whose
+ parameters are being emitted. */
static void
-write_method_parms (parm_list, method_p)
- tree parm_list;
+write_method_parms (parm_types, method_p, decl)
+ tree decl;
+ tree parm_types;
int method_p;
{
- tree first_parm;
+ tree first_parm_type;
+ tree parm_decl = decl ? DECL_ARGUMENTS (decl) : NULL_TREE;
+
/* Assume this parameter type list is variable-length. If it ends
with a void type, then it's not. */
int varargs_p = 1;
/* If this is a member function, skip the first arg, which is the
this pointer.
"Member functions do not encode the type of their implicit this
- parameter." */
+ parameter."
+
+ Similarly, there's no need to mangle artificial parameters, like
+ the VTT parameters for constructors and destructors. */
if (method_p)
- parm_list = TREE_CHAIN (parm_list);
-
- for (first_parm = parm_list;
- parm_list;
- parm_list = TREE_CHAIN (parm_list))
{
- tree parm = TREE_VALUE (parm_list);
+ parm_types = TREE_CHAIN (parm_types);
+ parm_decl = parm_decl ? TREE_CHAIN (parm_decl) : NULL_TREE;
+ while (parm_decl && DECL_ARTIFICIAL (parm_decl))
+ {
+ parm_types = TREE_CHAIN (parm_types);
+ parm_decl = TREE_CHAIN (parm_decl);
+ }
+ }
+
+ for (first_parm_type = parm_types;
+ parm_types;
+ parm_types = TREE_CHAIN (parm_types))
+ {
+ tree parm = TREE_VALUE (parm_types);
if (parm == void_type_node)
{
/* "Empty parameter lists, whether declared as () or
conventionally as (void), are encoded with a void parameter
(v)." */
- if (parm_list == first_parm)
+ if (parm_types == first_parm_type)
write_type (parm);
/* If the parm list is terminated with a void type, it's
fixed-length. */
varargs_p = 0;
/* A void type better be the last one. */
- my_friendly_assert (TREE_CHAIN (parm_list) == NULL, 20000523);
+ my_friendly_assert (TREE_CHAIN (parm_types) == NULL, 20000523);
}
else
write_type (parm);