Skip to content

Commit

Permalink
Fix incorrect demangling of call operator of lambda with explicit
Browse files Browse the repository at this point in the history
template parameters due to registering template parameters twice.

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@371469 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
zygoloid committed Sep 9, 2019
1 parent 2daf732 commit c0e3e24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/demangle/ItaniumDemangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,6 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
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_".
Expand Down Expand Up @@ -2702,7 +2699,6 @@ AbstractManglingParser<Derived, Alloc>::parseUnnamedTypeName(NameState *State) {
Node *T = parseTemplateParamDecl();
if (!T)
return nullptr;
LambdaTemplateParams.push_back(T);
Names.push_back(T);
}
NodeArray TempParams = popTrailingNodeArray(ParamsBegin);
Expand Down
7 changes: 6 additions & 1 deletion test/test_demangle.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit c0e3e24

Please sign in to comment.