aboutsummaryrefslogtreecommitdiff
path: root/libiberty/cp-demangle.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-03-01 15:09:29 +0000
committerNick Clifton <nickc@redhat.com>2017-03-01 15:09:29 +0000
commit134e805d3e18cf700a5046912b8dca9301fe6f2e (patch)
tree9f9dc03abc5e5d840195b9acb51701403957ac84 /libiberty/cp-demangle.c
parent01cca2f95e4a448cbfb7dc940cc38fe89300b15f (diff)
downloadgdb-134e805d3e18cf700a5046912b8dca9301fe6f2e.zip
gdb-134e805d3e18cf700a5046912b8dca9301fe6f2e.tar.gz
gdb-134e805d3e18cf700a5046912b8dca9301fe6f2e.tar.bz2
Sync libiberty sources with GCC mainline.
Brings in: 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR PR c++/70182 * cp-demangle.c (d_unqualified_name): Handle "on" for operator names. * testsuite/demangle-expected: Add tests. 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR c++/77489 * cp-demangle.c (d_discriminator): Handle discriminator >= 10. * testsuite/demangle-expected: Add tests for discriminator. 2016-12-13 Jakub Jelinek <jakub@redhat.com> PR c++/78761 * cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto). * testsuite/demangle-expected: Add test for decltype(auto).
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r--libiberty/cp-demangle.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 15ef3b4..f0dbf93 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -1594,6 +1594,8 @@ d_unqualified_name (struct d_info *di)
ret = d_source_name (di);
else if (IS_LOWER (peek))
{
+ if (peek == 'o' && d_peek_next_char (di) == 'n')
+ d_advance (di, 2);
ret = d_operator_name (di);
if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR)
{
@@ -3609,7 +3611,11 @@ d_local_name (struct d_info *di)
}
}
-/* <discriminator> ::= _ <(non-negative) number>
+/* <discriminator> ::= _ <number> # when number < 10
+ ::= __ <number> _ # when number >= 10
+
+ <discriminator> ::= _ <number> # when number >=10
+ is also accepted to support gcc versions that wrongly mangled that way.
We demangle the discriminator, but we don't print it out. FIXME:
We should print it out in verbose mode. */
@@ -3617,14 +3623,28 @@ d_local_name (struct d_info *di)
static int
d_discriminator (struct d_info *di)
{
- int discrim;
+ int discrim, num_underscores = 1;
if (d_peek_char (di) != '_')
return 1;
d_advance (di, 1);
+ if (d_peek_char (di) == '_')
+ {
+ ++num_underscores;
+ d_advance (di, 1);
+ }
+
discrim = d_number (di);
if (discrim < 0)
return 0;
+ if (num_underscores > 1 && discrim >= 10)
+ {
+ if (d_peek_char (di) == '_')
+ d_advance (di, 1);
+ else
+ return 0;
+ }
+
return 1;
}