From a77f94e24084115b80f1eb05836d7538b3500c36 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 17 Dec 2008 14:08:14 -0500 Subject: semantics.c (describable_type): New function. gcc/cp: * semantics.c (describable_type): New function. (finish_decltype_type): Use it for dependent exprs. * cp-tree.h: Declare it. * mangle.c (write_type) [DECLTYPE_TYPE]: Set skip_evaluation. (write_expression): If skip_evaluation, use type stubs. * tree.c (cp_tree_equal): Handle PARM_DECLs from different declarations of a function. * init.c (build_new): Do auto deduction if type is describable. * decl.c (cp_finish_decl): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. gcc/testsuite: * g++.dg/cpp0x/auto6.C: Test more stuff. * g++.dg/cpp0x/auto12.C: New test. libiberty: * cp-demangle.c (d_expression): Handle rvalue stubs too. [DEMANGLE_COMPONENT_CAST]: Update mangling. (d_print_comp): Avoid extra ", " with empty template argument packs. Remove handling for obsolete T() mangling. From-SVN: r142799 --- libiberty/ChangeLog | 7 +++++++ libiberty/cp-demangle.c | 34 +++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index a6721bf906d..4eaee542b3b 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,10 @@ +2008-12-17 Jason Merrill + + * cp-demangle.c (d_expression): Handle rvalue stubs too. + [DEMANGLE_COMPONENT_CAST]: Update mangling. + (d_print_comp): Avoid extra ", " with empty template argument packs. + Remove handling for obsolete T() mangling. + 2008-12-10 Jason Merrill * cp-demangle.c (cplus_demangle_type): Support fixed-point types. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index de0d9f7610e..8ab5729dbb7 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -2561,7 +2561,8 @@ d_expression (struct d_info *di) d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name, d_template_args (di))); } - else if (peek == 's' && d_peek_next_char (di) == 'T') + else if (peek == 's' + && (d_peek_next_char (di) == 'T' || d_peek_next_char (di) == 'R')) { /* Just demangle a parameter placeholder as its type. */ d_advance (di, 2); @@ -2608,20 +2609,22 @@ d_expression (struct d_info *di) args = op->u.s_extended_operator.args; break; case DEMANGLE_COMPONENT_CAST: - if (d_peek_char (di) == 'v') - /* T() encoded as an operand of void. */ - return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op, - cplus_demangle_type (di)); - else - args = 1; + args = 1; break; } 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) + 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; @@ -3763,8 +3766,14 @@ d_print_comp (struct d_print_info *dpi, d_print_comp (dpi, d_left (dc)); if (d_right (dc) != NULL) { + size_t len; d_append_string (dpi, ", "); + len = dpi->len; d_print_comp (dpi, d_right (dc)); + /* If that didn't print anything (which can happen with empty + template argument packs), remove the comma and space. */ + if (dpi->len == len) + dpi->len -= 2; } return; @@ -3800,12 +3809,7 @@ d_print_comp (struct d_print_info *dpi, d_print_cast (dpi, d_left (dc)); d_append_char (dpi, ')'); } - if (d_left (dc)->type == DEMANGLE_COMPONENT_CAST - && d_right (dc)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE) - /* type() -- FIXME what about type(multiple,args) */ - d_append_string (dpi, "()"); - else - d_print_subexpr (dpi, d_right (dc)); + d_print_subexpr (dpi, d_right (dc)); return; case DEMANGLE_COMPONENT_BINARY: -- cgit v1.2.1