From 49f2da1a16b6336cbc8f5273a3dc835625fbf23f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 6 Jan 2012 16:39:34 -0500 Subject: [PATCH] cp-demangle.c (cplus_demangle_type): decltype, pack expansion and vector are substitutable. * cp-demangle.c (cplus_demangle_type): decltype, pack expansion and vector are substitutable. (cplus_demangle_operators): Sort. From-SVN: r182969 --- libiberty/ChangeLog | 6 ++++++ libiberty/cp-demangle.c | 10 +++++++--- libiberty/testsuite/demangle-expected | 12 ++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 344f18dc7c46..97ea84fdc42b 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2012-01-06 Jason Merrill + + * cp-demangle.c (cplus_demangle_type): decltype, pack expansion + and vector are substitutable. + (cplus_demangle_operators): Sort. + 2012-01-04 Andreas Krebbel * configure: Regenerate. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 0f1166be48cc..0ed83976dfa5 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1554,7 +1554,8 @@ d_identifier (struct d_info *di, int len) /* operator_name ::= many different two character encodings. ::= cv ::= v -*/ + + This list is sorted for binary search. */ #define NL(s) s, (sizeof s) - 1 @@ -1566,6 +1567,8 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "aa", NL ("&&"), 2 }, { "ad", NL ("&"), 1 }, { "an", NL ("&"), 2 }, + { "at", NL ("alignof "), 1 }, + { "az", NL ("alignof "), 1 }, { "cl", NL ("()"), 2 }, { "cm", NL (","), 2 }, { "co", NL ("~"), 1 }, @@ -1611,8 +1614,6 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "rs", NL (">>"), 2 }, { "st", NL ("sizeof "), 1 }, { "sz", NL ("sizeof "), 1 }, - { "at", NL ("alignof "), 1 }, - { "az", NL ("alignof "), 1 }, { NULL, NULL, 0, 0 } }; @@ -2242,12 +2243,14 @@ cplus_demangle_type (struct d_info *di) d_expression (di), NULL); if (ret && d_next_char (di) != 'E') ret = NULL; + can_subst = 1; break; case 'p': /* Pack expansion. */ ret = d_make_comp (di, DEMANGLE_COMPONENT_PACK_EXPANSION, cplus_demangle_type (di), NULL); + can_subst = 1; break; case 'f': @@ -2298,6 +2301,7 @@ cplus_demangle_type (struct d_info *di) case 'v': ret = d_vector_type (di); + can_subst = 1; break; case 'n': diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 70abf681ae8f..642fe1427ed6 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4018,6 +4018,18 @@ K<1, &S::m>::f() --format=gnu-v3 _ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_ _ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_ +# A pack expansion is substitutable. +--format=gnu-v3 +_Z1fIJiEiEv1AIJDpT_EET0_S4_ +void f(A, int, int) +# So is decltype. +--format=gnu-v3 +_Z1fIiiEDTcvT__EET0_S2_ +decltype ((int)()) f(int, int) +# And vector. +--format=gnu-v3 +_Z1fDv4_iS_ +f(int __vector(4), int __vector(4)) # # Ada (GNAT) tests. #