From f9fb0b2d9f19b8c8a54584a3c98994127262b2c8 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Mon, 10 Oct 2011 21:02:57 +0000 Subject: [PATCH] merge from gcc --- libiberty/ChangeLog | 7 +++++++ libiberty/cp-demangle.c | 24 ++++++++++++++++++++++++ libiberty/testsuite/demangle-expected | 5 +++++ 3 files changed, 36 insertions(+) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 59460e43f0..6859afa04c 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,10 @@ +2011-10-10 Ian Lance Taylor + + PR c++/48665 + * cp-demangle.c (d_cv_qualifiers): If qualifiers are applied to a + function type, change them to apply to the "this" parameter. + * testsuite/demangle-expected: Add test case. + 2011-09-28 Doug Evans * timeval-utils.c: New file. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 32318e89fd..c7afef01f6 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -2294,8 +2294,10 @@ static struct demangle_component ** d_cv_qualifiers (struct d_info *di, struct demangle_component **pret, int member_fn) { + struct demangle_component **pstart; char peek; + pstart = pret; peek = d_peek_char (di); while (peek == 'r' || peek == 'V' || peek == 'K') { @@ -2332,6 +2334,28 @@ d_cv_qualifiers (struct d_info *di, peek = d_peek_char (di); } + if (!member_fn && peek == 'F') + { + while (pstart != pret) + { + switch ((*pstart)->type) + { + case DEMANGLE_COMPONENT_RESTRICT: + (*pstart)->type = DEMANGLE_COMPONENT_RESTRICT_THIS; + break; + case DEMANGLE_COMPONENT_VOLATILE: + (*pstart)->type = DEMANGLE_COMPONENT_VOLATILE_THIS; + break; + case DEMANGLE_COMPONENT_CONST: + (*pstart)->type = DEMANGLE_COMPONENT_CONST_THIS; + break; + default: + break; + } + pstart = &d_left (*pstart); + } + } + return pret; } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 64ccb92968..70abf681ae 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4198,3 +4198,8 @@ f1 _Z3fooi._omp_cpyfn.6 foo(int) [clone ._omp_cpyfn.6] foo +# +--format=gnu-v3 --no-params +_Z1fIKFvvES0_Evv +void f() +f