From 2979107801062274996feb3bb609c0b2f9d6a2a3 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Wed, 13 Sep 2000 23:09:30 +0000 Subject: [PATCH] demangle-expected: Add two tests for anonymous namespaces. * testsuite/demangle-expected: Add two tests for anonymous namespaces. * cplus-dem.c (gnu_special): Handle anonymous namespaces. From-SVN: r36398 --- libiberty/ChangeLog | 7 ++++++- libiberty/cplus-dem.c | 19 +++++++++++++++++++ libiberty/testsuite/demangle-expected | 8 ++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ee879c4ca8b..bb91224f4af 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2000-09-14 Hans-Peter Nilsson + + * testsuite/demangle-expected: Add two tests for anonymous + namespaces. + * cplus-dem.c (gnu_special): Handle anonymous namespaces. + 2000-09-10 Mark Mitchell * splay-tree.c (splay_tree_predecessor): New function. @@ -7,7 +13,6 @@ * testsuite/demangle-expected: Add four tests for type_info mangling. - * cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type, for a non-template non-qualified type_info function or node. diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 79b6dc5ccf7..3fe70b4030d 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -2811,6 +2811,25 @@ gnu_special (work, mangled, declp) success = 0; break; } + + if (n > 10 && strncmp (*mangled, "_GLOBAL_", 8) == 0 + && (*mangled)[9] == 'N' + && (*mangled)[8] == (*mangled)[10] + && strchr (cplus_markers, (*mangled)[8])) + { + /* A member of the anonymous namespace. There's information + about what identifier or filename it was keyed to, but + it's just there to make the mangled name unique; we just + step over it. */ + string_append (declp, "{anonymous}"); + (*mangled) += n; + + /* Now p points to the marker before the N, so we need to + update it to the first marker after what we consumed. */ + p = strpbrk (*mangled, cplus_markers); + break; + } + string_appendn (declp, *mangled, n); (*mangled) += n; } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index fb6448cffdf..a5d72fab0fe 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2558,3 +2558,11 @@ sockaddr * type_info node --format=gnu __tiPQ25libcwt16option_event_tct1Z12burst_app_ct libcw::option_event_tct * type_info node +# +--format=gnu +_27_GLOBAL_.N.__12burst_app_ct.app_instance +{anonymous}::app_instance +# +--format=gnu +_26_GLOBAL_\$N\$_tmp_n.iilg4Gya\$app_instance +{anonymous}::app_instance