Add name mangling for expr .* expr. Fixes PR9983 / <rdar://problem/9486332>.

llvm-svn: 132659
This commit is contained in:
Douglas Gregor 2011-06-05 05:27:58 +00:00
parent 7f139d8103
commit c507db4f70
2 changed files with 22 additions and 2 deletions

View File

@ -2039,6 +2039,7 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
// ::= <function-param>
// ::= sr <type> <unqualified-name> # dependent name
// ::= sr <type> <unqualified-name> <template-args> # dependent template-id
// ::= ds <expression> <expression> # expr.*expr
// ::= sZ <template-param> # size of a parameter pack
// ::= sZ <function-param> # size of a function parameter pack
// ::= <expr-primary>
@ -2317,8 +2318,11 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
case Expr::CompoundAssignOperatorClass: // fallthrough
case Expr::BinaryOperatorClass: {
const BinaryOperator *BO = cast<BinaryOperator>(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;

View File

@ -109,3 +109,19 @@ namespace test2 {
// CHECK: store float {{.*}}, float* @_ZZN5test21gIPFfvEEEvT_DTclfL0p_EEE8variable,
}
namespace test3 {
template <class T, class U> 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);
}
}