aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ChangeLog5
-rw-r--r--libiberty/ChangeLog6
-rw-r--r--libiberty/cp-demangle.c34
-rw-r--r--libiberty/testsuite/demangle-expected5
4 files changed, 46 insertions, 4 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 83c7bce..c99733e 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,10 @@
2011-06-22 Jakub Jelinek <jakub@redhat.com>
+ PR debug/47858
+ * dwarf2.h (enum dwarf_location_atom): Add DW_OP_GNU_parameter_ref.
+
+2011-06-22 Jakub Jelinek <jakub@redhat.com>
+
* dwarf2.h (enum dwarf_location_atom): Add DW_OP_GNU_parameter_ref.
2011-06-20 Jakub Jelinek <jakub@redhat.com>
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 0b8977c..7453b09 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/37089
+ * cp-demangle.c (d_print_comp): Handle reference smashing.
+ * testsuite/demangle-expected: Test it.
+
2011-06-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* cp-demangle.c (d_print_comp) <DEMANGLE_COMPONENT_FUNCTION_TYPE>:
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 3fc5266..d664e5f 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3554,6 +3554,10 @@ static void
d_print_comp (struct d_print_info *dpi, int options,
const struct demangle_component *dc)
{
+ /* Magic variable to let reference smashing skip over the next modifier
+ without needing to modify *dc. */
+ const struct demangle_component *mod_inner = NULL;
+
if (dc == NULL)
{
d_print_error (dpi);
@@ -3869,16 +3873,37 @@ d_print_comp (struct d_print_info *dpi, int options,
}
}
}
+ goto modifier;
+
+ case DEMANGLE_COMPONENT_REFERENCE:
+ case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
+ {
+ /* Handle reference smashing: & + && = &. */
+ const struct demangle_component *sub = d_left (dc);
+ if (sub->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
+ {
+ struct demangle_component *a = d_lookup_template_argument (dpi, sub);
+ if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
+ a = d_index_template_argument (a, dpi->pack_index);
+ sub = a;
+ }
+
+ if (sub->type == DEMANGLE_COMPONENT_REFERENCE
+ || sub->type == dc->type)
+ dc = sub;
+ else if (sub->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE)
+ mod_inner = d_left (sub);
+ }
/* Fall through. */
+
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
case DEMANGLE_COMPONENT_POINTER:
- case DEMANGLE_COMPONENT_REFERENCE:
- case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
case DEMANGLE_COMPONENT_COMPLEX:
case DEMANGLE_COMPONENT_IMAGINARY:
+ modifier:
{
/* We keep a list of modifiers on the stack. */
struct d_print_mod dpm;
@@ -3889,7 +3914,10 @@ d_print_comp (struct d_print_info *dpi, int options,
dpm.printed = 0;
dpm.templates = dpi->templates;
- d_print_comp (dpi, options, d_left (dc));
+ if (!mod_inner)
+ mod_inner = d_left (dc);
+
+ d_print_comp (dpi, options, mod_inner);
/* If the modifier didn't get printed by the type, print it
now. */
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index c94eb3c..bbd418c 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -3957,6 +3957,9 @@ decltype (({parm#1}.(operator-))()) h<A>(A)
_Z1fDn
f(decltype(nullptr))
--format=gnu-v3
+_Z1fIRiEvOT_b
+void f<int&>(int&, bool)
+--format=gnu-v3
_ZN5aaaaa6bbbbbb5cccccIN23ddddddddddddddddddddddd3eeeENS2_4ffff16ggggggggggggggggENS0_9hhhhhhhhhES6_S6_S6_S6_S6_S6_S6_EE
aaaaa::bbbbbb::ccccc<ddddddddddddddddddddddd::eee, ddddddddddddddddddddddd::ffff::gggggggggggggggg, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh, aaaaa::bbbbbb::hhhhhhhhh>
--format=gnu-v3
@@ -4118,4 +4121,4 @@ DFA
# http://sourceware.org/bugzilla/show_bug.cgi?id=11572
--format=auto
_ZN3Psi7VariantIIcPKcEE5visitIIRZN11VariantTest9TestVisit11test_methodEvEUlS2_E0_RZNS6_11test_methodEvEUlcE1_RZNS6_11test_methodEvEUlNS_4NoneEE_EEENS_13VariantDetail19SelectVisitorResultIIDpT_EE4typeEDpOSG_
-Psi::VariantDetail::SelectVisitorResult<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>::type Psi::Variant<char, char const*>::visit<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>((VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&&&)...)
+Psi::VariantDetail::SelectVisitorResult<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>::type Psi::Variant<char, char const*>::visit<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>((VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&)...)