From 1f3de044c6f615326d31ba878dfcd7fdeee7765f Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Sun, 11 Nov 2012 22:37:30 +0000 Subject: merge from gcc --- libiberty/ChangeLog | 12 ++++++++ libiberty/cp-demangle.c | 52 ++++++++++++++++++++++++++++------- libiberty/testsuite/demangle-expected | 3 ++ 3 files changed, 57 insertions(+), 10 deletions(-) (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 303dda2..7ecd6da 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,15 @@ +2012-11-10 Jason Merrill + + * cp-demangle.c (d_unqualified_name): Handle abi tags here. + (d_name): Not here. + +2012-11-09 Jason Merrill + + * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME. + (d_make_comp, d_find_pack, d_print_comp): Likewise. + (d_abi_tags): New. + (d_name): Call it. + 2012-10-08 Jason Merrill * cp-demangle.c (d_special_name, d_dump): Handle TH and TW. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 32df38c..913d4bf 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -508,6 +508,11 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_NAME: printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s); return; + case DEMANGLE_COMPONENT_TAGGED_NAME: + printf ("tagged name\n"); + d_dump (dc->u.s_binary.left, indent + 2); + d_dump (dc->u.s_binary.right, indent + 2); + return; case DEMANGLE_COMPONENT_TEMPLATE_PARAM: printf ("template parameter %ld\n", dc->u.s_number.number); return; @@ -809,6 +814,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_QUAL_NAME: case DEMANGLE_COMPONENT_LOCAL_NAME: case DEMANGLE_COMPONENT_TYPED_NAME: + case DEMANGLE_COMPONENT_TAGGED_NAME: case DEMANGLE_COMPONENT_TEMPLATE: case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: @@ -1202,6 +1208,23 @@ d_encoding (struct d_info *di, int top_level) } } +/* ::= B */ + +static struct demangle_component * +d_abi_tags (struct d_info *di, struct demangle_component *dc) +{ + char peek; + while (peek = d_peek_char (di), + peek == 'B') + { + struct demangle_component *tag; + d_advance (di, 1); + tag = d_source_name (di); + dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag); + } + return dc; +} + /* ::= ::= ::= @@ -1416,15 +1439,14 @@ d_prefix (struct d_info *di) static struct demangle_component * d_unqualified_name (struct d_info *di) { + struct demangle_component *ret; char peek; peek = d_peek_char (di); if (IS_DIGIT (peek)) - return d_source_name (di); + ret = d_source_name (di); else if (IS_LOWER (peek)) { - struct demangle_component *ret; - ret = d_operator_name (di); if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR) { @@ -1433,14 +1455,11 @@ d_unqualified_name (struct d_info *di) ret = d_make_comp (di, DEMANGLE_COMPONENT_UNARY, ret, d_source_name (di)); } - return ret; } else if (peek == 'C' || peek == 'D') - return d_ctor_dtor_name (di); + ret = d_ctor_dtor_name (di); else if (peek == 'L') { - struct demangle_component * ret; - d_advance (di, 1); ret = d_source_name (di); @@ -1448,22 +1467,27 @@ d_unqualified_name (struct d_info *di) return NULL; if (! d_discriminator (di)) return NULL; - return ret; } else if (peek == 'U') { switch (d_peek_next_char (di)) { case 'l': - return d_lambda (di); + ret = d_lambda (di); + break; case 't': - return d_unnamed_type (di); + ret = d_unnamed_type (di); + break; default: return NULL; } } else return NULL; + + if (d_peek_char (di) == 'B') + ret = d_abi_tags (di, ret); + return ret; } /* ::= <(positive length) number> */ @@ -3745,6 +3769,7 @@ d_find_pack (struct d_print_info *dpi, case DEMANGLE_COMPONENT_LAMBDA: case DEMANGLE_COMPONENT_NAME: + case DEMANGLE_COMPONENT_TAGGED_NAME: case DEMANGLE_COMPONENT_OPERATOR: case DEMANGLE_COMPONENT_BUILTIN_TYPE: case DEMANGLE_COMPONENT_SUB_STD: @@ -3830,6 +3855,13 @@ d_print_comp (struct d_print_info *dpi, int options, d_print_java_identifier (dpi, dc->u.s_name.s, dc->u.s_name.len); return; + case DEMANGLE_COMPONENT_TAGGED_NAME: + d_print_comp (dpi, options, d_left (dc)); + d_append_string (dpi, "[abi:"); + d_print_comp (dpi, options, d_right (dc)); + d_append_char (dpi, ']'); + return; + case DEMANGLE_COMPONENT_QUAL_NAME: case DEMANGLE_COMPONENT_LOCAL_NAME: d_print_comp (dpi, options, d_left (dc)); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 6b55d30..5b41b03 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4084,6 +4084,9 @@ auto& f(int const&, int) --format=gnu-v3 _Z1gILi1EEvR1AIXT_EER1BIXscbT_EE void g<1>(A<1>&, B(1)>&) +--format=gnu-v3 +_ZNKSt7complexIiE4realB5cxx11Ev +std::complex::real[abi:cxx11]() const # # Ada (GNAT) tests. # -- cgit v1.1