aboutsummaryrefslogtreecommitdiff
path: root/libiberty/cp-demangle.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-03-23 17:03:01 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-03-23 17:03:01 -0400
commit6afcfe0a8080cf3816e841f0f1c2b96a73baed43 (patch)
treeea6d54ba1fb63d8cc661d04df277796e02ed2ac1 /libiberty/cp-demangle.c
parent6ab282f65064d9d22b04a89b0958fefbec50ebc3 (diff)
downloadgcc-6afcfe0a8080cf3816e841f0f1c2b96a73baed43.zip
gcc-6afcfe0a8080cf3816e841f0f1c2b96a73baed43.tar.gz
gcc-6afcfe0a8080cf3816e841f0f1c2b96a73baed43.tar.bz2
pt.c (make_fnparm_pack): Split out from...
* gcc/cp/pt.c (make_fnparm_pack): Split out from... (instantiate_decl): ...here. (tsubst_pack_expansion): Handle being called in a late-specified return type. * libiberty/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. From-SVN: r145013
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c24
1 files changed, 21 insertions, 3 deletions
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)
{