From 63f62df485de57c6b0db167d96bb0f92562adb7b Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 5 Jun 2011 05:27:58 +0000 Subject: [PATCH] Add name mangling for expr .* expr. Fixes PR9983 / . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132659 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ItaniumMangle.cpp | 8 ++++++-- test/CodeGenCXX/mangle-exprs.cpp | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index 53c204562a..2b9fa42cf4 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -2039,6 +2039,7 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) { // ::= // ::= sr # dependent name // ::= sr # dependent template-id + // ::= ds # expr.*expr // ::= sZ # size of a parameter pack // ::= sZ # size of a function parameter pack // ::= @@ -2317,8 +2318,11 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) { case Expr::CompoundAssignOperatorClass: // fallthrough case Expr::BinaryOperatorClass: { const BinaryOperator *BO = cast(E); - mangleOperatorName(BinaryOperator::getOverloadedOperator(BO->getOpcode()), - /*Arity=*/2); + if (BO->getOpcode() == BO_PtrMemD) + Out << "ds"; + else + mangleOperatorName(BinaryOperator::getOverloadedOperator(BO->getOpcode()), + /*Arity=*/2); mangleExpression(BO->getLHS()); mangleExpression(BO->getRHS()); break; diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp index 46c46f04a8..75294e059c 100644 --- a/test/CodeGenCXX/mangle-exprs.cpp +++ b/test/CodeGenCXX/mangle-exprs.cpp @@ -109,3 +109,19 @@ namespace test2 { // CHECK: store float {{.*}}, float* @_ZZN5test21gIPFfvEEEvT_DTclfL0p_EEE8variable, } + +namespace test3 { + template void a(T x, U y, decltype(x.*y) z) {} + + struct X { + int *member; + }; + + // CHECK: define void @_ZN5test311instantiateEv + void instantiate() { + X x; + int *ip; + // CHECK: call void @_ZN5test31aINS_1XEMS1_PiEEvT_T0_DTdsfL0p_fL0p0_E + a(x, &X::member, ip); + } +}