return p;
}
+/* Add a new function parameter. */
+
+static struct demangle_component *
+d_make_function_param (struct d_info *di, long i)
+{
+ struct demangle_component *p;
+
+ p = d_make_empty (di);
+ if (p != NULL)
+ {
+ p->type = DEMANGLE_COMPONENT_FUNCTION_PARAM;
+ p->u.s_number.number = i;
+ }
+ return p;
+}
+
/* Add a new standard substitution component. */
static struct demangle_component *
struct demangle_component *
cplus_demangle_mangled_name (struct d_info *di, int top_level)
{
- if (! d_check_char (di, '_'))
+ if (! d_check_char (di, '_')
+ /* Allow missing _ if not at toplevel to work around a
+ bug in G++ abi-version=2 mangling; see the comment in
+ write_template_arg. */
+ && top_level)
return NULL;
if (! d_check_char (di, 'Z'))
return NULL;
{ "rs", NL (">>"), 2 },
{ "st", NL ("sizeof "), 1 },
{ "sz", NL ("sizeof "), 1 },
+ { "at", NL ("alignof "), 1 },
+ { "az", NL ("alignof "), 1 },
{ NULL, NULL, 0, 0 }
};
d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
d_template_args (di)));
}
- else if (peek == 's'
- && (d_peek_next_char (di) == 'T' || d_peek_next_char (di) == 'R'))
+ else if (peek == 'f' && d_peek_next_char (di) == 'p')
{
- /* Just demangle a parameter placeholder as its type. */
+ /* Function parameter used in a late-specified return type. */
+ int index;
d_advance (di, 2);
- return cplus_demangle_type (di);
+ if (d_peek_char (di) == '_')
+ index = 1;
+ else
+ {
+ index = d_number (di);
+ if (index < 0)
+ return NULL;
+ index += 2;
+ }
+
+ if (! d_check_char (di, '_'))
+ return NULL;
+
+ return d_make_function_param (di, index);
}
else if (IS_DIGIT (peek))
{
switch (args)
{
case 1:
- return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
- d_expression (di));
+ {
+ struct demangle_component *operand;
+ if (op->type == DEMANGLE_COMPONENT_CAST
+ && d_check_char (di, '_'))
+ operand = d_exprlist (di);
+ else
+ operand = d_expression (di);
+ return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
+ operand);
+ }
case 2:
{
struct demangle_component *left;
if (! d_check_char (di, 'L'))
return NULL;
- if (d_peek_char (di) == '_')
+ if (d_peek_char (di) == '_'
+ /* Workaround for G++ bug; see comment in write_template_arg. */
+ || d_peek_char (di) == 'Z')
ret = cplus_demangle_mangled_name (di, 0);
else
{
the right place for the type. We also have to pass down
any CV-qualifiers, which apply to the this parameter. */
hold_modifiers = dpi->modifiers;
+ dpi->modifiers = 0;
i = 0;
typed_name = d_left (dc);
while (typed_name != NULL)
}
return;
+ case DEMANGLE_COMPONENT_FUNCTION_PARAM:
+ {
+ char buf[25];
+ d_append_string (dpi, "parm#");
+ sprintf(buf,"%ld", dc->u.s_number.number);
+ d_append_string (dpi, buf);
+ return;
+ }
+
default:
d_print_error (dpi);
return;
# This used to crash the demangler--PR 16240
--format=gnu-v3 --no-params
_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
-_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
+PatternDriver::StringScalarDeleteValue::StringScalarDeleteValue(PatternDriver::ConflateStringScalarValue const&, PatternDriver::AbstractStringScalarValue const&, PatternDriver::TemplateEnum<PatternDriver::pdcomplement, PatternDriver::complement_names, PatternDriver::COMPLEMENTENUM> const&)
PatternDriver::StringScalarDeleteValue::StringScalarDeleteValue
#
# This used to cause the demangler to walk into undefined memory--PR 22268
java resource java/util/iso4217.properties
# decltype/param placeholder test
--format=gnu-v3
-_Z3addIidEDTplsTT_sTT0_ES0_S1_
-decltype ((int)+(double)) add<int, double>(int, double)
+_Z3addIidEDTplfp_fp0_ET_T0_
+decltype ((parm#1)+(parm#2)) add<int, double>(int, double)
# decltype/fn call test
--format=gnu-v3
-_Z4add3IidEDTclL_Z1gEsTT_sTT0_EES0_S1_
-decltype (g(int, double)) add3<int, double>(int, double)
+_Z4add3IidEDTclL_Z1gEfp_fp0_EET_T0_
+decltype (g(parm#1, parm#2)) add3<int, double>(int, double)
# new (2008) built in types test
--format=gnu-v3
_Z1fDfDdDeDhDsDi
void f<int*, float*, double*>(int*, float*, double*)
# '.' test
--format=gnu-v3
-_Z1hI1AIiEdEDTcldtsTT_1gIT0_EEES2_S3_
-decltype (((A<int>).(g<double>))()) h<A<int>, double>(A<int>, double)
+_Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_
+decltype (((parm#1).(g<double>))()) h<A<int>, double>(A<int>, double)
+# test for typed function in decltype
+--format=gnu-v3
+_ZN1AIiE1jIiEEDTplfp_clL_Z1xvEEET_
+decltype ((parm#1)+((x())())) A<int>::j<int>(int)