aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2009-03-23 22:05:12 +0000
committerDJ Delorie <dj@redhat.com>2009-03-23 22:05:12 +0000
commite2e1864d3b9e347761a9549f00cd128ed17fb12d (patch)
treea0defb82b1f760f6245e58298bef6b40539604e0
parentcb010894ee1a20c856455954d294401efd4d8e74 (diff)
downloadgdb-e2e1864d3b9e347761a9549f00cd128ed17fb12d.zip
gdb-e2e1864d3b9e347761a9549f00cd128ed17fb12d.tar.gz
gdb-e2e1864d3b9e347761a9549f00cd128ed17fb12d.tar.bz2
merge from gcc
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/cp-demangle.c24
-rw-r--r--libiberty/testsuite/demangle-expected10
3 files changed, 36 insertions, 6 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 00aa57a..a15a860 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-23 Jason Merrill <jason@redhat.com>
+
+ * cp-demangle.c (d_expression): Handle pack expansion.
+ (d_find_pack): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM.
+ (d_print_subexpr): Don't wrap function parms in ().
+ (d_print_comp) [DEMANGLE_COMPONENT_PACK_EXPANSION]: Handle
+ not finding a pack.
+
2009-03-17 Jason Merrill <jason@redhat.com>
* cp-demangle.c (d_make_function_param): new fn.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index e6d3d5e..b02f9bb 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -2586,6 +2586,12 @@ 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) == 'p')
+ {
+ d_advance (di, 2);
+ return d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION,
+ d_expression (di), NULL);
+ }
else if (peek == 'f' && d_peek_next_char (di) == 'p')
{
/* Function parameter used in a late-specified return type. */
@@ -3244,6 +3250,7 @@ d_find_pack (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_BUILTIN_TYPE:
case DEMANGLE_COMPONENT_SUB_STD:
case DEMANGLE_COMPONENT_CHARACTER:
+ case DEMANGLE_COMPONENT_FUNCTION_PARAM:
return NULL;
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
@@ -3284,7 +3291,8 @@ d_print_subexpr (struct d_print_info *dpi,
const struct demangle_component *dc)
{
int simple = 0;
- if (dc->type == DEMANGLE_COMPONENT_NAME)
+ if (dc->type == DEMANGLE_COMPONENT_NAME
+ || dc->type == DEMANGLE_COMPONENT_FUNCTION_PARAM)
simple = 1;
if (!simple)
d_append_char (dpi, '(');
@@ -4012,10 +4020,20 @@ d_print_comp (struct d_print_info *dpi,
case DEMANGLE_COMPONENT_PACK_EXPANSION:
{
- struct demangle_component *a = d_find_pack (dpi, d_left (dc));
- int len = d_pack_length (a);
+ int len;
int i;
+ struct demangle_component *a = d_find_pack (dpi, d_left (dc));
+ if (a == NULL)
+ {
+ /* d_find_pack won't find anything if the only packs involved
+ in this expansion are function parameter packs; in that
+ case, just print the pattern and "...". */
+ d_print_subexpr (dpi, d_left (dc));
+ d_append_string (dpi, "...");
+ return;
+ }
+ len = d_pack_length (a);
dc = d_left (dc);
for (i = 0; i < len; ++i)
{
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index cded6b5..0c45118 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3885,7 +3885,7 @@ java resource java/util/iso4217.properties
# decltype/param placeholder test
--format=gnu-v3
_Z3addIidEDTplfp_fp0_ET_T0_
-decltype ((parm#1)+(parm#2)) add<int, double>(int, double)
+decltype (parm#1+parm#2) add<int, double>(int, double)
# decltype/fn call test
--format=gnu-v3
_Z4add3IidEDTclL_Z1gEfp_fp0_EET_T0_
@@ -3901,8 +3901,12 @@ void f<int*, float*, double*>(int*, float*, double*)
# '.' test
--format=gnu-v3
_Z1hI1AIiEdEDTcldtfp_1gIT0_EEET_S2_
-decltype (((parm#1).(g<double>))()) h<A<int>, double>(A<int>, double)
+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)
+decltype (parm#1+((x())())) A<int>::j<int>(int)
+# test for expansion of function parameter pack
+--format=gnu-v3
+_Z1gIIidEEDTclL_Z1fEspplfp_Li1EEEDpT_
+decltype (f((parm#1+(1))...)) g<int, double>(int, double)