[libcxxabi] r303737 - __cxa_demangle: Fix constructor cv qualifier handling

Tamas Berghammer via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 04:21:36 PDT 2017


Author: tberghammer
Date: Wed May 24 06:21:34 2017
New Revision: 303737

URL: http://llvm.org/viewvc/llvm-project?rev=303737&view=rev
Log:
__cxa_demangle: Fix constructor cv qualifier handling

Summary:
Previously if we parsed a constructor then we set parsed_ctor_dtor_cv
to true and never reseted it. This causes issue when a template argument
references a constructor (e.g. type of lambda defined inside a
constructor) as we will have the parsed_ctor_dtor_cv flag set what will
cause issues when parsing later arguments.

Reviewers: EricWF, compnerd

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33385

Modified:
    libcxxabi/trunk/src/cxa_demangle.cpp
    libcxxabi/trunk/test/test_demangle.pass.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=303737&r1=303736&r2=303737&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed May 24 06:21:34 2017
@@ -4571,6 +4571,8 @@ parse_encoding(const char* first, const
         save_value<decltype(db.tag_templates)> sb(db.tag_templates);
         if (db.encoding_depth > 1)
             db.tag_templates = true;
+        save_value<decltype(db.parsed_ctor_dtor_cv)> sp(db.parsed_ctor_dtor_cv);
+        db.parsed_ctor_dtor_cv = false;
         switch (*first)
         {
         case 'G':

Modified: libcxxabi/trunk/test/test_demangle.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=303737&r1=303736&r2=303737&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_demangle.pass.cpp (original)
+++ libcxxabi/trunk/test/test_demangle.pass.cpp Wed May 24 06:21:34 2017
@@ -29500,6 +29500,7 @@ const char* cases[][2] =
     {"_ZZ2f6vE1b", "f6()::b"},
     {"_ZNV3$_35test9Ev", "$_3::test9() volatile"},
     {"_ZN5Test8I3$_2EC1ES0_", "Test8<$_2>::Test8($_2)"},
+    {"_Z3fooIZN3BarC1EvE3$_0EvT_", "void foo<Bar::Bar()::$_0>(Bar::Bar()::$_0)"},
     {"_ZGVZN1N1gEvE1a", "guard variable for N::g()::a"},
     {"_ZplRK1YRA100_P1X", "operator+(Y const&, X* (&) [100])"},
     {"_Z1fno", "f(__int128, unsigned __int128)"},




More information about the cfe-commits mailing list