[libcxx-commits] [libcxxabi] r371469 - Fix incorrect demangling of call operator of lambda with explicit

Richard Smith via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 9 16:07:25 PDT 2019


Author: rsmith
Date: Mon Sep  9 16:07:25 2019
New Revision: 371469

URL: http://llvm.org/viewvc/llvm-project?rev=371469&view=rev
Log:
Fix incorrect demangling of call operator of lambda with explicit
template parameters due to registering template parameters twice.

Modified:
    libcxxabi/trunk/src/demangle/ItaniumDemangle.h
    libcxxabi/trunk/test/test_demangle.pass.cpp

Modified: libcxxabi/trunk/src/demangle/ItaniumDemangle.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/ItaniumDemangle.h?rev=371469&r1=371468&r2=371469&view=diff
==============================================================================
--- libcxxabi/trunk/src/demangle/ItaniumDemangle.h (original)
+++ libcxxabi/trunk/src/demangle/ItaniumDemangle.h Mon Sep  9 16:07:25 2019
@@ -2358,9 +2358,6 @@ template <typename Derived, typename All
       assert(Parser->TemplateParams.size() >= OldNumTemplateParamLists);
       Parser->TemplateParams.dropBack(OldNumTemplateParamLists);
     }
-    void push_back(Node *Param) {
-      Params.push_back(Param);
-    }
   };
 
   // Template parameter table. Like the above, but referenced like "T42_".
@@ -2702,7 +2699,6 @@ AbstractManglingParser<Derived, Alloc>::
       Node *T = parseTemplateParamDecl();
       if (!T)
         return nullptr;
-      LambdaTemplateParams.push_back(T);
       Names.push_back(T);
     }
     NodeArray TempParams = popTrailingNodeArray(ParamsBegin);

Modified: libcxxabi/trunk/test/test_demangle.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=371469&r1=371468&r2=371469&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_demangle.pass.cpp (original)
+++ libcxxabi/trunk/test/test_demangle.pass.cpp Mon Sep  9 16:07:25 2019
@@ -29784,9 +29784,14 @@ const char* cases[][2] =
     {"_ZNK1xMUlTyT_E_clIiEEDaS_", "auto x::'lambda'<typename $T>($T)::operator()<int>(x) const"},
     {"_ZNK1xMUlTnPA3_ivE_clILS0_0EEEDav", "auto x::'lambda'<int (*$N) [3]>()::operator()<(int [3])0>() const"},
     {"_ZNK1xMUlTyTtTyTnT_TpTnPA3_TL0__ETpTyvE_clIi1XJfEEEDav", "auto x::'lambda'<typename $T, template<typename $T0, $T $N, $T0 (*...$N0) [3]> typename $TT, typename ...$T1>()::operator()<int, X, float>() const"},
-    {"_ZN1AIiE1fIfEEvDTLUlTyTtTyTnTL1__ETL0_1_T_TL0__E_EE", "void A<int>::f<float>(decltype([]<typename $T, template<typename $T0, $T0 $N> typename $TT>($TT, float, $T){...}))"},
+    {"_ZN1AIiE1fIfEEvDTLUlTyTtTyTnTL1__ETL0_1_T_TL0__E_EE", "void A<int>::f<float>(decltype([]<typename $T, template<typename $T0, $T0 $N> typename $TT>(auto, float, $T){...}))"},
     {"_ZN1S1fILb1EEEv1XILUlvE_EE", "void S::f<true>(X<[](){...}>)"},
     {"_ZN1S1fILb1EEEv1XILUlvE0_EE", "void S::f<true>(X<[](){...}>)"},
+    // FIXME: Consider special-casing the call operator of a lambda and
+    // producing something like
+    //   "auto inline_func()::'lambda'<int, int>(int, int) const"
+    {"_ZZ11inline_funcvENKUlTyTyT_T0_E_clIiiEEDaS_S0_", "auto inline_func()::'lambda'<typename $T, typename $T0>($T, $T0)::operator()<int, int>($T, $T0) const"},
+    {"_ZZ11inline_funcvENKUlTyTyT_T1_T0_E_clIiiiEEDaS_S0_S1_", "auto inline_func()::'lambda'<typename $T, typename $T0>($T, auto, $T0)::operator()<int, int, int>($T, auto, $T0) const"},
 };
 
 const unsigned N = sizeof(cases) / sizeof(cases[0]);




More information about the libcxx-commits mailing list