static tree
decl_mangling_context (tree decl)
{
+ tree tcontext = targetm.cxx.decl_mangling_context (decl);
+
+ if (tcontext != NULL_TREE)
+ return tcontext;
+
if (TREE_CODE (decl) == TYPE_DECL
&& LAMBDA_TYPE_P (TREE_TYPE (decl)))
{
static void
write_unscoped_name (const tree decl)
{
- tree context = CP_DECL_CONTEXT (decl);
+ tree context = decl_mangling_context (decl);
MANGLE_TRACE_TREE ("unscoped-name", decl);
/* <prefix> ::= <prefix> <unqualified-name>
::= <template-param>
::= <template-prefix> <template-args>
+ ::= <decltype>
::= # empty
::= <substitution> */
MANGLE_TRACE_TREE ("prefix", node);
+ if (TREE_CODE (node) == DECLTYPE_TYPE)
+ {
+ write_type (node);
+ return;
+ }
+
if (find_substitution (node))
return;
case DECLTYPE_TYPE:
/* These shouldn't make it into mangling. */
gcc_assert (!DECLTYPE_FOR_LAMBDA_CAPTURE (type)
- && !DECLTYPE_FOR_LAMBDA_RETURN (type));
+ && !DECLTYPE_FOR_LAMBDA_PROXY (type));
/* In ABI <5, we stripped decltype of a plain decl. */
if (!abi_version_at_least (5)
write_char ('L');
write_type (TREE_TYPE (value));
- switch (TREE_CODE (value))
- {
- case CONST_DECL:
- write_integer_cst (DECL_INITIAL (value));
- break;
+ /* Write a null member pointer value as (type)0, regardless of its
+ real representation. */
+ if (null_member_pointer_value_p (value))
+ write_integer_cst (integer_zero_node);
+ else
+ switch (TREE_CODE (value))
+ {
+ case CONST_DECL:
+ write_integer_cst (DECL_INITIAL (value));
+ break;
- case INTEGER_CST:
- gcc_assert (!same_type_p (TREE_TYPE (value), boolean_type_node)
- || integer_zerop (value) || integer_onep (value));
- write_integer_cst (value);
- break;
+ case INTEGER_CST:
+ gcc_assert (!same_type_p (TREE_TYPE (value), boolean_type_node)
+ || integer_zerop (value) || integer_onep (value));
+ write_integer_cst (value);
+ break;
- case REAL_CST:
- write_real_cst (value);
- break;
+ case REAL_CST:
+ write_real_cst (value);
+ break;
- case STRING_CST:
- sorry ("string literal in function template signature");
- break;
+ case STRING_CST:
+ sorry ("string literal in function template signature");
+ break;
- default:
- gcc_unreachable ();
- }
+ default:
+ gcc_unreachable ();
+ }
write_char ('E');
}
/* A template appearing as a template arg is a template template arg. */
write_template_template_arg (node);
else if ((TREE_CODE_CLASS (code) == tcc_constant && code != PTRMEM_CST)
- || (abi_version_at_least (2) && code == CONST_DECL))
+ || (abi_version_at_least (2) && code == CONST_DECL)
+ || null_member_pointer_value_p (node))
write_template_arg_literal (node);
else if (DECL_P (node))
{