* cp-demangle.c (d_name): Detect local-source-name.
authorGeoffrey Keating <geoffk@geoffk.org>
Sun, 6 May 2007 00:25:11 +0000 (00:25 +0000)
committerGeoffrey Keating <geoffk@geoffk.org>
Sun, 6 May 2007 00:25:11 +0000 (00:25 +0000)
(d_prefix): Likewise.
(d_unqualified_name): Implement local-source-name.

libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected

index 431ef1d..c4e7072 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2007-05-03  Joel Brobecker  <brobecker@adacore.com>
 
        * filename_cmp.c: Replace include of ctype.h by include of
index 5c930c6..992b358 100644 (file)
@@ -1100,6 +1100,9 @@ d_name (struct d_info *di)
     case 'Z':
       return d_local_name (di);
 
+    case 'L':
+      return d_unqualified_name (di);
+       
     case 'S':
       {
        int subst;
@@ -1220,7 +1223,8 @@ d_prefix (struct d_info *di)
       if (IS_DIGIT (peek)
          || IS_LOWER (peek)
          || peek == 'C'
-         || peek == 'D')
+         || peek == 'D'
+         || peek == 'L')
        dc = d_unqualified_name (di);
       else if (peek == 'S')
        dc = d_substitution (di, 1);
@@ -1254,6 +1258,9 @@ d_prefix (struct d_info *di)
 /* <unqualified-name> ::= <operator-name>
                       ::= <ctor-dtor-name>
                       ::= <source-name>
+                     ::= <local-source-name> 
+
+    <local-source-name>        ::= L <source-name> <discriminator>
 */
 
 static struct demangle_component *
@@ -1275,6 +1282,19 @@ d_unqualified_name (struct d_info *di)
     }
   else if (peek == 'C' || peek == 'D')
     return d_ctor_dtor_name (di);
+  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;
+    }
   else
     return NULL;
 }
index 471819e..f1afc45 100644 (file)
@@ -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)