cp-demangle.c (d_abi_tags): Preserve di->last_name across any ABI tags.
authorIan Lance Taylor <iant@google.com>
Sat, 15 Aug 2015 13:23:30 +0000 (13:23 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 15 Aug 2015 13:23:30 +0000 (13:23 +0000)
* cp-demangle.c (d_abi_tags): Preserve di->last_name across any
ABI tags.

From-SVN: r226910

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

index d1c632460e5bb4451cdb5f76d87e26013416957e..8fdf6d2d83cc3e31aa6332725e32d61a56f80ceb 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-15  Ian Lance Taylor  <iant@google.com>
+
+       * cp-demangle.c (d_abi_tags): Preserve di->last_name across any
+       ABI tags.
+
 2015-08-11  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        * d-demangle.c (dlang_parse_real): Remove call to strtod.
index 82541004bf7762a022eea7d884bdf321631b4f95..c587895086d3cbc2fef7d03fb9ba3c005eda2cb9 100644 (file)
@@ -1306,7 +1306,12 @@ d_encoding (struct d_info *di, int top_level)
 static struct demangle_component *
 d_abi_tags (struct d_info *di, struct demangle_component *dc)
 {
+  struct demangle_component *hold_last_name;
   char peek;
+
+  /* Preserve the last name, so the ABI tag doesn't clobber it.  */
+  hold_last_name = di->last_name;
+
   while (peek = d_peek_char (di),
         peek == 'B')
     {
@@ -1315,6 +1320,9 @@ d_abi_tags (struct d_info *di, struct demangle_component *dc)
       tag = d_source_name (di);
       dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag);
     }
+
+  di->last_name = hold_last_name;
+
   return dc;
 }
 
index 4c6359e6fa85a747adfaa965358cf28d0ea1660c..5200cb34d19f421682ec57bf4af5be2903c56fdf 100644 (file)
@@ -4389,3 +4389,9 @@ f(std::string[abi:foo], std::string[abi:foo])
 --format=gnu-v3
 _Z18IndirectExternCallIPU7stdcallU7regparmILi3EEFviiEiEvT_T0_S3_
 void IndirectExternCall<void ( regparm<3> stdcall*)(int, int), int>(void ( regparm<3> stdcall*)(int, int), int, void ( regparm<3> stdcall*)(int, int))
+# 
+# ABI tags used to confuse the constructor name calculation.
+--format=gnu-v3 --no-params
+_ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code
+std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&)
+std::ios_base::failure[abi:cxx11]::failure