2007-05-05 Geoffrey Keating <geoffk@apple.com>
* cp-demangle.c (d_name): Detect local-source-name.
(d_prefix): Likewise.
(d_unqualified_name): Implement local-source-name.
--- libiberty//testsuite/demangle-expected.~1~ 2007-10-13 13:25:43.000000000 -0700
+++ libiberty//testsuite/demangle-expected 2009-03-27 15:36:17.000000000 -0700
@@ -3842,3 +3842,19 @@ _ZNT
--format=gnu-v3
_Z1aMark
_Z1aMark
+# <local-source-name> test 1
+--format=gnu-v3
+_ZL3foo_2
+foo
+# <local-source-name> test 2
+--format=gnu-v3
+_ZZL3foo_2vE4var1
+foo()::var1
+# <local-source-name> test 3
+--format=gnu-v3
+_ZZL3foo_2vE4var1_0
+foo()::var1
+# <local-source-name> test 4
+--format=gnu-v3
+_ZZN7myspaceL3foo_1EvEN11localstruct1fEZNS_3fooEvE16otherlocalstruct
+myspace::foo()::localstruct::f(myspace::foo()::otherlocalstruct)
Index: libiberty/cp-demangle.c
===================================================================
--- libiberty/cp-demangle.c (revision 127085)
+++ libiberty/cp-demangle.c (revision 127086)
@@ -1054,6 +1054,11 @@
case 'Z':
return d_local_name (di);
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ case 'L':
+ return d_unqualified_name (di);
+
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
case 'S':
{
int subst;
@@ -1174,7 +1179,10 @@
if (IS_DIGIT (peek)
|| IS_LOWER (peek)
|| peek == 'C'
- || peek == 'D')
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ || peek == 'D'
+ || peek == 'L')
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
dc = d_unqualified_name (di);
else if (peek == 'S')
dc = d_substitution (di, 1);
@@ -1208,6 +1216,11 @@
/* <unqualified-name> ::= <operator-name>
::= <ctor-dtor-name>
::= <source-name>
+ APPLE LOCAL begin mainline 2007-05-09 5173149
+ ::= <local-source-name>
+
+ <local-source-name> ::= L <source-name> <discriminator>
+ APPLE LOCAL end mainline 2007-05-09 5173149
*/
static struct demangle_component *
@@ -1229,6 +1242,21 @@
}
else if (peek == 'C' || peek == 'D')
return d_ctor_dtor_name (di);
+/* APPLE LOCAL begin mainline 2007-05-09 5173149 */ \
+ else if (peek == 'L')
+ {
+ struct demangle_component * ret;
+
+ d_advance (di, 1);
+
+ ret = d_source_name (di);
+ if (ret == NULL)
+ return NULL;
+ if (! d_discriminator (di))
+ return NULL;
+ return ret;
+ }
+/* APPLE LOCAL end mainline 2007-05-09 5173149 */ \
else
return NULL;
}