diff options
author | Nick Clifton <nickc@redhat.com> | 2021-07-03 14:00:33 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-07-03 14:00:33 +0100 |
commit | 20c4b12e937b20f0998bd25ad37c77145650e826 (patch) | |
tree | bcc05850ae7ed90cedb0368ab7f8b3a88a703500 /libiberty/cp-demangle.c | |
parent | 0d03c52682bec990371b2f006e186641cf86f923 (diff) | |
download | gdb-20c4b12e937b20f0998bd25ad37c77145650e826.zip gdb-20c4b12e937b20f0998bd25ad37c77145650e826.tar.gz gdb-20c4b12e937b20f0998bd25ad37c77145650e826.tar.bz2 |
Synchronize libiberty sources (and include/demangle.h) with GCC master version
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r-- | libiberty/cp-demangle.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index d3e7984..33490f6 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -815,6 +815,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_LITERAL_NEG: printf ("negative literal\n"); break; + case DEMANGLE_COMPONENT_VENDOR_EXPR: + printf ("vendor expression\n"); + break; case DEMANGLE_COMPONENT_JAVA_RESOURCE: printf ("java resource\n"); break; @@ -976,6 +979,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_TRINARY_ARG1: case DEMANGLE_COMPONENT_LITERAL: case DEMANGLE_COMPONENT_LITERAL_NEG: + case DEMANGLE_COMPONENT_VENDOR_EXPR: case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_VECTOR_TYPE: case DEMANGLE_COMPONENT_CLONE: @@ -3344,6 +3348,7 @@ d_unresolved_name (struct d_info *di) ::= cl <expression>+ E ::= st <type> ::= <template-param> + ::= u <source-name> <template-arg>* E # vendor extended expression ::= <unresolved-name> ::= <expr-primary> @@ -3425,6 +3430,15 @@ d_expression_1 (struct d_info *di) return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST, type, d_exprlist (di, 'E')); } + else if (peek == 'u') + { + /* A vendor extended expression. */ + struct demangle_component *name, *args; + d_advance (di, 1); + name = d_source_name (di); + args = d_template_args_1 (di); + return d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_EXPR, name, args); + } else { struct demangle_component *op; @@ -4229,6 +4243,7 @@ d_count_templates_scopes (struct d_print_info *dpi, case DEMANGLE_COMPONENT_TRINARY_ARG2: case DEMANGLE_COMPONENT_LITERAL: case DEMANGLE_COMPONENT_LITERAL_NEG: + case DEMANGLE_COMPONENT_VENDOR_EXPR: case DEMANGLE_COMPONENT_JAVA_RESOURCE: case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_DECLTYPE: @@ -5509,18 +5524,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options, } case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: - { - struct demangle_component *name = dc->u.s_extended_operator.name; - if (name->type == DEMANGLE_COMPONENT_NAME - && !strncmp (name->u.s_name.s, "__alignof__", name->u.s_name.len)) - d_print_comp (dpi, options, dc->u.s_extended_operator.name); - else - { - d_append_string (dpi, "operator "); - d_print_comp (dpi, options, dc->u.s_extended_operator.name); - } - return; - } + d_append_string (dpi, "operator "); + d_print_comp (dpi, options, dc->u.s_extended_operator.name); + return; case DEMANGLE_COMPONENT_CONVERSION: d_append_string (dpi, "operator "); @@ -5585,14 +5591,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options, if (code && !strcmp (code, "gs")) /* Avoid parens after '::'. */ d_print_comp (dpi, options, operand); - else if ((code && !strcmp (code, "st")) - || (op->type == DEMANGLE_COMPONENT_EXTENDED_OPERATOR - && (op->u.s_extended_operator.name->type - == DEMANGLE_COMPONENT_NAME) - && !strncmp (op->u.s_extended_operator.name->u.s_name.s, - "__alignof__", - op->u.s_extended_operator.name->u.s_name.len))) - /* Always print parens for sizeof (type) and __alignof__. */ + else if (code && !strcmp (code, "st")) + /* Always print parens for sizeof (type). */ { d_append_char (dpi, '('); d_print_comp (dpi, options, operand); @@ -5805,6 +5805,13 @@ d_print_comp_inner (struct d_print_info *dpi, int options, } return; + case DEMANGLE_COMPONENT_VENDOR_EXPR: + d_print_comp (dpi, options, d_left (dc)); + d_append_char (dpi, '('); + d_print_comp (dpi, options, d_right (dc)); + d_append_char (dpi, ')'); + return; + case DEMANGLE_COMPONENT_NUMBER: d_append_num (dpi, dc->u.s_number.number); return; |