Line 646... |
Line 646... |
printf ("argument list\n");
|
printf ("argument list\n");
|
break;
|
break;
|
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
|
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
|
printf ("template argument list\n");
|
printf ("template argument list\n");
|
break;
|
break;
|
|
case DEMANGLE_COMPONENT_INITIALIZER_LIST:
|
|
printf ("initializer list\n");
|
|
break;
|
case DEMANGLE_COMPONENT_CAST:
|
case DEMANGLE_COMPONENT_CAST:
|
printf ("cast\n");
|
printf ("cast\n");
|
break;
|
break;
|
|
case DEMANGLE_COMPONENT_NULLARY:
|
|
printf ("nullary operator\n");
|
|
break;
|
case DEMANGLE_COMPONENT_UNARY:
|
case DEMANGLE_COMPONENT_UNARY:
|
printf ("unary operator\n");
|
printf ("unary operator\n");
|
break;
|
break;
|
case DEMANGLE_COMPONENT_BINARY:
|
case DEMANGLE_COMPONENT_BINARY:
|
printf ("binary operator\n");
|
printf ("binary operator\n");
|
Line 804... |
Line 810... |
case DEMANGLE_COMPONENT_UNARY:
|
case DEMANGLE_COMPONENT_UNARY:
|
case DEMANGLE_COMPONENT_BINARY:
|
case DEMANGLE_COMPONENT_BINARY:
|
case DEMANGLE_COMPONENT_BINARY_ARGS:
|
case DEMANGLE_COMPONENT_BINARY_ARGS:
|
case DEMANGLE_COMPONENT_TRINARY:
|
case DEMANGLE_COMPONENT_TRINARY:
|
case DEMANGLE_COMPONENT_TRINARY_ARG1:
|
case DEMANGLE_COMPONENT_TRINARY_ARG1:
|
case DEMANGLE_COMPONENT_TRINARY_ARG2:
|
|
case DEMANGLE_COMPONENT_LITERAL:
|
case DEMANGLE_COMPONENT_LITERAL:
|
case DEMANGLE_COMPONENT_LITERAL_NEG:
|
case DEMANGLE_COMPONENT_LITERAL_NEG:
|
case DEMANGLE_COMPONENT_COMPOUND_NAME:
|
case DEMANGLE_COMPONENT_COMPOUND_NAME:
|
case DEMANGLE_COMPONENT_VECTOR_TYPE:
|
case DEMANGLE_COMPONENT_VECTOR_TYPE:
|
case DEMANGLE_COMPONENT_CLONE:
|
case DEMANGLE_COMPONENT_CLONE:
|
Line 841... |
Line 846... |
case DEMANGLE_COMPONENT_JAVA_RESOURCE:
|
case DEMANGLE_COMPONENT_JAVA_RESOURCE:
|
case DEMANGLE_COMPONENT_DECLTYPE:
|
case DEMANGLE_COMPONENT_DECLTYPE:
|
case DEMANGLE_COMPONENT_PACK_EXPANSION:
|
case DEMANGLE_COMPONENT_PACK_EXPANSION:
|
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
|
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
|
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
|
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
|
|
case DEMANGLE_COMPONENT_NULLARY:
|
|
case DEMANGLE_COMPONENT_TRINARY_ARG2:
|
if (left == NULL)
|
if (left == NULL)
|
return NULL;
|
return NULL;
|
break;
|
break;
|
|
|
/* This needs a right parameter, but the left parameter can be
|
/* This needs a right parameter, but the left parameter can be
|
empty. */
|
empty. */
|
case DEMANGLE_COMPONENT_ARRAY_TYPE:
|
case DEMANGLE_COMPONENT_ARRAY_TYPE:
|
|
case DEMANGLE_COMPONENT_INITIALIZER_LIST:
|
if (right == NULL)
|
if (right == NULL)
|
return NULL;
|
return NULL;
|
break;
|
break;
|
|
|
/* These are allowed to have no parameters--in some cases they
|
/* These are allowed to have no parameters--in some cases they
|
Line 1552... |
Line 1560... |
}
|
}
|
|
|
/* operator_name ::= many different two character encodings.
|
/* operator_name ::= many different two character encodings.
|
::= cv <type>
|
::= cv <type>
|
::= v <digit> <source-name>
|
::= v <digit> <source-name>
|
*/
|
|
|
This list is sorted for binary search. */
|
|
|
#define NL(s) s, (sizeof s) - 1
|
#define NL(s) s, (sizeof s) - 1
|
|
|
CP_STATIC_IF_GLIBCPP_V3
|
CP_STATIC_IF_GLIBCPP_V3
|
const struct demangle_operator_info cplus_demangle_operators[] =
|
const struct demangle_operator_info cplus_demangle_operators[] =
|
Line 1564... |
Line 1573... |
{ "aN", NL ("&="), 2 },
|
{ "aN", NL ("&="), 2 },
|
{ "aS", NL ("="), 2 },
|
{ "aS", NL ("="), 2 },
|
{ "aa", NL ("&&"), 2 },
|
{ "aa", NL ("&&"), 2 },
|
{ "ad", NL ("&"), 1 },
|
{ "ad", NL ("&"), 1 },
|
{ "an", NL ("&"), 2 },
|
{ "an", NL ("&"), 2 },
|
|
{ "at", NL ("alignof "), 1 },
|
|
{ "az", NL ("alignof "), 1 },
|
{ "cl", NL ("()"), 2 },
|
{ "cl", NL ("()"), 2 },
|
{ "cm", NL (","), 2 },
|
{ "cm", NL (","), 2 },
|
{ "co", NL ("~"), 1 },
|
{ "co", NL ("~"), 1 },
|
{ "dV", NL ("/="), 2 },
|
{ "dV", NL ("/="), 2 },
|
{ "da", NL ("delete[]"), 1 },
|
{ "da", NL ("delete[]"), 1 },
|
{ "de", NL ("*"), 1 },
|
{ "de", NL ("*"), 1 },
|
{ "dl", NL ("delete"), 1 },
|
{ "dl", NL ("delete"), 1 },
|
|
{ "ds", NL (".*"), 2 },
|
{ "dt", NL ("."), 2 },
|
{ "dt", NL ("."), 2 },
|
{ "dv", NL ("/"), 2 },
|
{ "dv", NL ("/"), 2 },
|
{ "eO", NL ("^="), 2 },
|
{ "eO", NL ("^="), 2 },
|
{ "eo", NL ("^"), 2 },
|
{ "eo", NL ("^"), 2 },
|
{ "eq", NL ("=="), 2 },
|
{ "eq", NL ("=="), 2 },
|
{ "ge", NL (">="), 2 },
|
{ "ge", NL (">="), 2 },
|
|
{ "gs", NL ("::"), 1 },
|
{ "gt", NL (">"), 2 },
|
{ "gt", NL (">"), 2 },
|
{ "ix", NL ("[]"), 2 },
|
{ "ix", NL ("[]"), 2 },
|
{ "lS", NL ("<<="), 2 },
|
{ "lS", NL ("<<="), 2 },
|
{ "le", NL ("<="), 2 },
|
{ "le", NL ("<="), 2 },
|
{ "ls", NL ("<<"), 2 },
|
{ "ls", NL ("<<"), 2 },
|
Line 1588... |
Line 1601... |
{ "mI", NL ("-="), 2 },
|
{ "mI", NL ("-="), 2 },
|
{ "mL", NL ("*="), 2 },
|
{ "mL", NL ("*="), 2 },
|
{ "mi", NL ("-"), 2 },
|
{ "mi", NL ("-"), 2 },
|
{ "ml", NL ("*"), 2 },
|
{ "ml", NL ("*"), 2 },
|
{ "mm", NL ("--"), 1 },
|
{ "mm", NL ("--"), 1 },
|
{ "na", NL ("new[]"), 1 },
|
{ "na", NL ("new[]"), 3 },
|
{ "ne", NL ("!="), 2 },
|
{ "ne", NL ("!="), 2 },
|
{ "ng", NL ("-"), 1 },
|
{ "ng", NL ("-"), 1 },
|
{ "nt", NL ("!"), 1 },
|
{ "nt", NL ("!"), 1 },
|
{ "nw", NL ("new"), 1 },
|
{ "nw", NL ("new"), 3 },
|
{ "oR", NL ("|="), 2 },
|
{ "oR", NL ("|="), 2 },
|
{ "oo", NL ("||"), 2 },
|
{ "oo", NL ("||"), 2 },
|
{ "or", NL ("|"), 2 },
|
{ "or", NL ("|"), 2 },
|
{ "pL", NL ("+="), 2 },
|
{ "pL", NL ("+="), 2 },
|
{ "pl", NL ("+"), 2 },
|
{ "pl", NL ("+"), 2 },
|
Line 1609... |
Line 1622... |
{ "rS", NL (">>="), 2 },
|
{ "rS", NL (">>="), 2 },
|
{ "rm", NL ("%"), 2 },
|
{ "rm", NL ("%"), 2 },
|
{ "rs", NL (">>"), 2 },
|
{ "rs", NL (">>"), 2 },
|
{ "st", NL ("sizeof "), 1 },
|
{ "st", NL ("sizeof "), 1 },
|
{ "sz", NL ("sizeof "), 1 },
|
{ "sz", NL ("sizeof "), 1 },
|
{ "at", NL ("alignof "), 1 },
|
{ "tr", NL ("throw"), 0 },
|
{ "az", NL ("alignof "), 1 },
|
{ "tw", NL ("throw "), 1 },
|
{ NULL, NULL, 0, 0 }
|
{ NULL, NULL, 0, 0 }
|
};
|
};
|
|
|
static struct demangle_component *
|
static struct demangle_component *
|
d_operator_name (struct d_info *di)
|
d_operator_name (struct d_info *di)
|
Line 2240... |
Line 2253... |
/* decltype (expression) */
|
/* decltype (expression) */
|
ret = d_make_comp (di, DEMANGLE_COMPONENT_DECLTYPE,
|
ret = d_make_comp (di, DEMANGLE_COMPONENT_DECLTYPE,
|
d_expression (di), NULL);
|
d_expression (di), NULL);
|
if (ret && d_next_char (di) != 'E')
|
if (ret && d_next_char (di) != 'E')
|
ret = NULL;
|
ret = NULL;
|
|
can_subst = 1;
|
break;
|
break;
|
|
|
case 'p':
|
case 'p':
|
/* Pack expansion. */
|
/* Pack expansion. */
|
ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
|
ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
|
cplus_demangle_type (di), NULL);
|
cplus_demangle_type (di), NULL);
|
|
can_subst = 1;
|
break;
|
break;
|
|
|
case 'f':
|
case 'f':
|
/* 32-bit decimal floating point */
|
/* 32-bit decimal floating point */
|
ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[26]);
|
ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[26]);
|
Line 2296... |
Line 2311... |
ret->u.s_fixed.sat = (peek == 's');
|
ret->u.s_fixed.sat = (peek == 's');
|
break;
|
break;
|
|
|
case 'v':
|
case 'v':
|
ret = d_vector_type (di);
|
ret = d_vector_type (di);
|
|
can_subst = 1;
|
break;
|
break;
|
|
|
case 'n':
|
case 'n':
|
/* decltype(nullptr) */
|
/* decltype(nullptr) */
|
ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
|
ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[32]);
|
Line 2673... |
Line 2689... |
/* Preserve the last name we saw--don't let the template arguments
|
/* Preserve the last name we saw--don't let the template arguments
|
clobber it, as that would give us the wrong name for a subsequent
|
clobber it, as that would give us the wrong name for a subsequent
|
constructor or destructor. */
|
constructor or destructor. */
|
hold_last_name = di->last_name;
|
hold_last_name = di->last_name;
|
|
|
if (! d_check_char (di, 'I'))
|
if (d_peek_char (di) != 'I'
|
|
&& d_peek_char (di) != 'J')
|
return NULL;
|
return NULL;
|
|
d_advance (di, 1);
|
|
|
if (d_peek_char (di) == 'E')
|
if (d_peek_char (di) == 'E')
|
{
|
{
|
/* An argument pack can be empty. */
|
/* An argument pack can be empty. */
|
d_advance (di, 1);
|
d_advance (di, 1);
|
Line 2733... |
Line 2751... |
|
|
case 'L':
|
case 'L':
|
return d_expr_primary (di);
|
return d_expr_primary (di);
|
|
|
case 'I':
|
case 'I':
|
|
case 'J':
|
/* An argument pack. */
|
/* An argument pack. */
|
return d_template_args (di);
|
return d_template_args (di);
|
|
|
default:
|
default:
|
return cplus_demangle_type (di);
|
return cplus_demangle_type (di);
|
}
|
}
|
}
|
}
|
|
|
/* Subroutine of <expression> ::= cl <expression>+ E */
|
/* Parse a sequence of expressions until we hit the terminator
|
|
character. */
|
|
|
static struct demangle_component *
|
static struct demangle_component *
|
d_exprlist (struct d_info *di)
|
d_exprlist (struct d_info *di, char terminator)
|
{
|
{
|
struct demangle_component *list = NULL;
|
struct demangle_component *list = NULL;
|
struct demangle_component **p = &list;
|
struct demangle_component **p = &list;
|
|
|
if (d_peek_char (di) == 'E')
|
if (d_peek_char (di) == terminator)
|
{
|
{
|
d_advance (di, 1);
|
d_advance (di, 1);
|
return d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, NULL, NULL);
|
return d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, NULL, NULL);
|
}
|
}
|
|
|
Line 2766... |
Line 2786... |
*p = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, arg, NULL);
|
*p = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, arg, NULL);
|
if (*p == NULL)
|
if (*p == NULL)
|
return NULL;
|
return NULL;
|
p = &d_right (*p);
|
p = &d_right (*p);
|
|
|
if (d_peek_char (di) == 'E')
|
if (d_peek_char (di) == terminator)
|
{
|
{
|
d_advance (di, 1);
|
d_advance (di, 1);
|
break;
|
break;
|
}
|
}
|
}
|
}
|
Line 2857... |
Line 2877... |
return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
|
return d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name,
|
d_template_args (di));
|
d_template_args (di));
|
else
|
else
|
return name;
|
return name;
|
}
|
}
|
|
else if ((peek == 'i' || peek == 't')
|
|
&& d_peek_next_char (di) == 'l')
|
|
{
|
|
/* Brace-enclosed initializer list, untyped or typed. */
|
|
struct demangle_component *type = NULL;
|
|
if (peek == 't')
|
|
type = cplus_demangle_type (di);
|
|
d_advance (di, 2);
|
|
return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
|
|
type, d_exprlist (di, 'E'));
|
|
}
|
else
|
else
|
{
|
{
|
struct demangle_component *op;
|
struct demangle_component *op;
|
|
const char *code = NULL;
|
int args;
|
int args;
|
|
|
op = d_operator_name (di);
|
op = d_operator_name (di);
|
if (op == NULL)
|
if (op == NULL)
|
return NULL;
|
return NULL;
|
|
|
if (op->type == DEMANGLE_COMPONENT_OPERATOR)
|
if (op->type == DEMANGLE_COMPONENT_OPERATOR)
|
|
{
|
|
code = op->u.s_operator.op->code;
|
di->expansion += op->u.s_operator.op->len - 2;
|
di->expansion += op->u.s_operator.op->len - 2;
|
|
if (strcmp (code, "st") == 0)
|
if (op->type == DEMANGLE_COMPONENT_OPERATOR
|
|
&& strcmp (op->u.s_operator.op->code, "st") == 0)
|
|
return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
|
return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
|
cplus_demangle_type (di));
|
cplus_demangle_type (di));
|
|
}
|
|
|
switch (op->type)
|
switch (op->type)
|
{
|
{
|
default:
|
default:
|
return NULL;
|
return NULL;
|
Line 2891... |
Line 2924... |
break;
|
break;
|
}
|
}
|
|
|
switch (args)
|
switch (args)
|
{
|
{
|
|
case 0:
|
|
return d_make_comp (di, DEMANGLE_COMPONENT_NULLARY, op, NULL);
|
|
|
case 1:
|
case 1:
|
{
|
{
|
struct demangle_component *operand;
|
struct demangle_component *operand;
|
|
int suffix = 0;
|
|
|
|
if (code && (code[0] == 'p' || code[0] == 'm')
|
|
&& code[1] == code[0])
|
|
/* pp_ and mm_ are the prefix variants. */
|
|
suffix = !d_check_char (di, '_');
|
|
|
if (op->type == DEMANGLE_COMPONENT_CAST
|
if (op->type == DEMANGLE_COMPONENT_CAST
|
&& d_check_char (di, '_'))
|
&& d_check_char (di, '_'))
|
operand = d_exprlist (di);
|
operand = d_exprlist (di, 'E');
|
else
|
else
|
operand = d_expression (di);
|
operand = d_expression (di);
|
|
|
|
if (suffix)
|
|
/* Indicate the suffix variant for d_print_comp. */
|
|
return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
|
|
d_make_comp (di,
|
|
DEMANGLE_COMPONENT_BINARY_ARGS,
|
|
operand, operand));
|
|
else
|
return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
|
return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op,
|
operand);
|
operand);
|
}
|
}
|
case 2:
|
case 2:
|
{
|
{
|
struct demangle_component *left;
|
struct demangle_component *left;
|
struct demangle_component *right;
|
struct demangle_component *right;
|
const char *code = op->u.s_operator.op->code;
|
|
|
|
left = d_expression (di);
|
left = d_expression (di);
|
if (!strcmp (code, "cl"))
|
if (!strcmp (code, "cl"))
|
right = d_exprlist (di);
|
right = d_exprlist (di, 'E');
|
else if (!strcmp (code, "dt") || !strcmp (code, "pt"))
|
else if (!strcmp (code, "dt") || !strcmp (code, "pt"))
|
{
|
{
|
right = d_unqualified_name (di);
|
right = d_unqualified_name (di);
|
if (d_peek_char (di) == 'I')
|
if (d_peek_char (di) == 'I')
|
right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE,
|
right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE,
|
Line 2930... |
Line 2980... |
}
|
}
|
case 3:
|
case 3:
|
{
|
{
|
struct demangle_component *first;
|
struct demangle_component *first;
|
struct demangle_component *second;
|
struct demangle_component *second;
|
|
struct demangle_component *third;
|
|
|
|
if (!strcmp (code, "qu"))
|
|
{
|
|
/* ?: expression. */
|
first = d_expression (di);
|
first = d_expression (di);
|
second = d_expression (di);
|
second = d_expression (di);
|
|
third = d_expression (di);
|
|
}
|
|
else if (code[0] == 'n')
|
|
{
|
|
/* new-expression. */
|
|
if (code[1] != 'w' && code[1] != 'a')
|
|
return NULL;
|
|
first = d_exprlist (di, '_');
|
|
second = cplus_demangle_type (di);
|
|
if (d_peek_char (di) == 'E')
|
|
{
|
|
d_advance (di, 1);
|
|
third = NULL;
|
|
}
|
|
else if (d_peek_char (di) == 'p'
|
|
&& d_peek_next_char (di) == 'i')
|
|
{
|
|
/* Parenthesized initializer. */
|
|
d_advance (di, 2);
|
|
third = d_exprlist (di, 'E');
|
|
}
|
|
else if (d_peek_char (di) == 'i'
|
|
&& d_peek_next_char (di) == 'l')
|
|
/* initializer-list. */
|
|
third = d_expression (di);
|
|
else
|
|
return NULL;
|
|
}
|
|
else
|
|
return NULL;
|
return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op,
|
return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op,
|
d_make_comp (di,
|
d_make_comp (di,
|
DEMANGLE_COMPONENT_TRINARY_ARG1,
|
DEMANGLE_COMPONENT_TRINARY_ARG1,
|
first,
|
first,
|
d_make_comp (di,
|
d_make_comp (di,
|
DEMANGLE_COMPONENT_TRINARY_ARG2,
|
DEMANGLE_COMPONENT_TRINARY_ARG2,
|
second,
|
second, third)));
|
d_expression (di))));
|
|
}
|
}
|
default:
|
default:
|
return NULL;
|
return NULL;
|
}
|
}
|
}
|
}
|
Line 3660... |
Line 3743... |
d_print_subexpr (struct d_print_info *dpi, int options,
|
d_print_subexpr (struct d_print_info *dpi, int options,
|
const struct demangle_component *dc)
|
const struct demangle_component *dc)
|
{
|
{
|
int simple = 0;
|
int simple = 0;
|
if (dc->type == DEMANGLE_COMPONENT_NAME
|
if (dc->type == DEMANGLE_COMPONENT_NAME
|
|
|| dc->type == DEMANGLE_COMPONENT_QUAL_NAME
|
|
|| dc->type == DEMANGLE_COMPONENT_INITIALIZER_LIST
|
|| dc->type == DEMANGLE_COMPONENT_FUNCTION_PARAM)
|
|| dc->type == DEMANGLE_COMPONENT_FUNCTION_PARAM)
|
simple = 1;
|
simple = 1;
|
if (!simple)
|
if (!simple)
|
d_append_char (dpi, '(');
|
d_append_char (dpi, '(');
|
d_print_comp (dpi, options, dc);
|
d_print_comp (dpi, options, dc);
|
Line 4255... |
Line 4340... |
if (dpi->flush_count == flush_count && dpi->len == len)
|
if (dpi->flush_count == flush_count && dpi->len == len)
|
dpi->len -= 2;
|
dpi->len -= 2;
|
}
|
}
|
return;
|
return;
|
|
|
|
case DEMANGLE_COMPONENT_INITIALIZER_LIST:
|
|
{
|
|
struct demangle_component *type = d_left (dc);
|
|
struct demangle_component *list = d_right (dc);
|
|
|
|
if (type)
|
|
d_print_comp (dpi, options, type);
|
|
d_append_char (dpi, '{');
|
|
d_print_comp (dpi, options, list);
|
|
d_append_char (dpi, '}');
|
|
}
|
|
return;
|
|
|
case DEMANGLE_COMPONENT_OPERATOR:
|
case DEMANGLE_COMPONENT_OPERATOR:
|
{
|
{
|
char c;
|
const struct demangle_operator_info *op = dc->u.s_operator.op;
|
|
int len = op->len;
|
|
|
d_append_string (dpi, "operator");
|
d_append_string (dpi, "operator");
|
c = dc->u.s_operator.op->name[0];
|
/* Add a space before new/delete. */
|
if (IS_LOWER (c))
|
if (IS_LOWER (op->name[0]))
|
d_append_char (dpi, ' ');
|
d_append_char (dpi, ' ');
|
d_append_buffer (dpi, dc->u.s_operator.op->name,
|
/* Omit a trailing space. */
|
dc->u.s_operator.op->len);
|
if (op->name[len-1] == ' ')
|
|
--len;
|
|
d_append_buffer (dpi, op->name, len);
|
return;
|
return;
|
}
|
}
|
|
|
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
|
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
|
d_append_string (dpi, "operator ");
|
d_append_string (dpi, "operator ");
|
Line 4278... |
Line 4379... |
case DEMANGLE_COMPONENT_CAST:
|
case DEMANGLE_COMPONENT_CAST:
|
d_append_string (dpi, "operator ");
|
d_append_string (dpi, "operator ");
|
d_print_cast (dpi, options, dc);
|
d_print_cast (dpi, options, dc);
|
return;
|
return;
|
|
|
case DEMANGLE_COMPONENT_UNARY:
|
case DEMANGLE_COMPONENT_NULLARY:
|
if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR
|
|
&& d_left (dc)->u.s_operator.op->len == 1
|
|
&& d_left (dc)->u.s_operator.op->name[0] == '&'
|
|
&& d_right (dc)->type == DEMANGLE_COMPONENT_TYPED_NAME
|
|
&& d_left (d_right (dc))->type == DEMANGLE_COMPONENT_QUAL_NAME
|
|
&& d_right (d_right (dc))->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
|
|
{
|
|
/* Address of a function (therefore in an expression context) must
|
|
have its argument list suppressed.
|
|
|
|
unary operator ... dc
|
|
operator & ... d_left (dc)
|
|
typed name ... d_right (dc)
|
|
qualified name ... d_left (d_right (dc))
|
|
<names>
|
|
function type ... d_right (d_right (dc))
|
|
argument list
|
|
<arguments> */
|
|
|
|
d_print_expr_op (dpi, options, d_left (dc));
|
d_print_expr_op (dpi, options, d_left (dc));
|
d_print_comp (dpi, options, d_left (d_right (dc)));
|
|
return;
|
return;
|
}
|
|
else if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR
|
|
&& d_left (dc)->u.s_operator.op->len == 1
|
|
&& d_left (dc)->u.s_operator.op->name[0] == '&'
|
|
&& d_right (dc)->type == DEMANGLE_COMPONENT_QUAL_NAME)
|
|
{
|
|
/* Keep also already processed variant without the argument list.
|
|
|
|
unary operator ... dc
|
case DEMANGLE_COMPONENT_UNARY:
|
operator & ... d_left (dc)
|
{
|
qualified name ... d_right (dc)
|
struct demangle_component *op = d_left (dc);
|
<names> */
|
struct demangle_component *operand = d_right (dc);
|
|
const char *code = NULL;
|
|
|
d_print_expr_op (dpi, options, d_left (dc));
|
if (op->type == DEMANGLE_COMPONENT_OPERATOR)
|
d_print_comp (dpi, options, d_right (dc));
|
{
|
|
code = op->u.s_operator.op->code;
|
|
if (!strcmp (code, "ad"))
|
|
{
|
|
/* Don't print the argument list for the address of a
|
|
function. */
|
|
if (operand->type == DEMANGLE_COMPONENT_TYPED_NAME
|
|
&& d_left (operand)->type == DEMANGLE_COMPONENT_QUAL_NAME
|
|
&& d_right (operand)->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
|
|
operand = d_left (operand);
|
|
}
|
|
if (operand->type == DEMANGLE_COMPONENT_BINARY_ARGS)
|
|
{
|
|
/* This indicates a suffix operator. */
|
|
operand = d_left (operand);
|
|
d_print_subexpr (dpi, options, operand);
|
|
d_print_expr_op (dpi, options, op);
|
return;
|
return;
|
}
|
}
|
else if (d_left (dc)->type != DEMANGLE_COMPONENT_CAST)
|
}
|
d_print_expr_op (dpi, options, d_left (dc));
|
|
|
if (op->type != DEMANGLE_COMPONENT_CAST)
|
|
d_print_expr_op (dpi, options, op);
|
else
|
else
|
{
|
{
|
d_append_char (dpi, '(');
|
d_append_char (dpi, '(');
|
d_print_cast (dpi, options, d_left (dc));
|
d_print_cast (dpi, options, op);
|
d_append_char (dpi, ')');
|
d_append_char (dpi, ')');
|
}
|
}
|
d_print_subexpr (dpi, options, d_right (dc));
|
if (code && !strcmp (code, "gs"))
|
|
/* Avoid parens after '::'. */
|
|
d_print_comp (dpi, options, operand);
|
|
else if (code && !strcmp (code, "st"))
|
|
/* Always print parens for sizeof (type). */
|
|
{
|
|
d_append_char (dpi, '(');
|
|
d_print_comp (dpi, options, operand);
|
|
d_append_char (dpi, ')');
|
|
}
|
|
else
|
|
d_print_subexpr (dpi, options, operand);
|
|
}
|
return;
|
return;
|
|
|
case DEMANGLE_COMPONENT_BINARY:
|
case DEMANGLE_COMPONENT_BINARY:
|
if (d_right (dc)->type != DEMANGLE_COMPONENT_BINARY_ARGS)
|
if (d_right (dc)->type != DEMANGLE_COMPONENT_BINARY_ARGS)
|
{
|
{
|
Line 4391... |
Line 4496... |
|| d_right (d_right (dc))->type != DEMANGLE_COMPONENT_TRINARY_ARG2)
|
|| d_right (d_right (dc))->type != DEMANGLE_COMPONENT_TRINARY_ARG2)
|
{
|
{
|
d_print_error (dpi);
|
d_print_error (dpi);
|
return;
|
return;
|
}
|
}
|
d_print_subexpr (dpi, options, d_left (d_right (dc)));
|
{
|
d_print_expr_op (dpi, options, d_left (dc));
|
struct demangle_component *op = d_left (dc);
|
d_print_subexpr (dpi, options, d_left (d_right (d_right (dc))));
|
struct demangle_component *first = d_left (d_right (dc));
|
|
struct demangle_component *second = d_left (d_right (d_right (dc)));
|
|
struct demangle_component *third = d_right (d_right (d_right (dc)));
|
|
|
|
if (!strcmp (op->u.s_operator.op->code, "qu"))
|
|
{
|
|
d_print_subexpr (dpi, options, first);
|
|
d_print_expr_op (dpi, options, op);
|
|
d_print_subexpr (dpi, options, second);
|
d_append_string (dpi, " : ");
|
d_append_string (dpi, " : ");
|
d_print_subexpr (dpi, options, d_right (d_right (d_right (dc))));
|
d_print_subexpr (dpi, options, third);
|
|
}
|
|
else
|
|
{
|
|
d_append_string (dpi, "new ");
|
|
if (d_left (first) != NULL)
|
|
{
|
|
d_print_subexpr (dpi, options, first);
|
|
d_append_char (dpi, ' ');
|
|
}
|
|
d_print_comp (dpi, options, second);
|
|
if (third)
|
|
d_print_subexpr (dpi, options, third);
|
|
}
|
|
}
|
return;
|
return;
|
|
|
case DEMANGLE_COMPONENT_TRINARY_ARG1:
|
case DEMANGLE_COMPONENT_TRINARY_ARG1:
|
case DEMANGLE_COMPONENT_TRINARY_ARG2:
|
case DEMANGLE_COMPONENT_TRINARY_ARG2:
|
/* We should only see these are part of DEMANGLE_COMPONENT_TRINARY. */
|
/* We should only see these are part of DEMANGLE_COMPONENT_TRINARY. */
|