Fix mangling numbers for varargs lambdas; varargs and non-varargs lambdas get

different lambda-sigs, so they should have different counters.

llvm-svn: 284933
This commit is contained in:
Richard Smith 2016-10-23 04:53:03 +00:00
parent 249237cb2e
commit c7f576fc91
2 changed files with 13 additions and 2 deletions

View File

@ -63,9 +63,10 @@ public:
CallOperator->getType()->getAs<FunctionProtoType>();
ASTContext &Context = CallOperator->getASTContext();
FunctionProtoType::ExtProtoInfo EPI;
EPI.Variadic = Proto->isVariadic();
QualType Key =
Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(),
FunctionProtoType::ExtProtoInfo());
Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(), EPI);
Key = Context.getCanonicalType(Key);
return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
}

View File

@ -173,6 +173,16 @@ namespace PR12123 {
// CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %"struct.PR12123::A"* @_ZZN7PR121231B1fERKSt9type_infoEd_NKUlvE_clEv
// CHECK-LABEL: define {{.*}} @_Z{{[0-9]*}}testVarargsLambdaNumberingv(
inline int testVarargsLambdaNumbering() {
// CHECK: testVarargsLambdaNumberingvE{{.*}}UlzE_
auto a = [](...) { static int n; return ++n; };
// CHECK: testVarargsLambdaNumberingvE{{.*}}UlvE_
auto b = []() { static int n; return ++n; };
return a() + b();
}
int k = testVarargsLambdaNumbering();
// Check linkage of the various lambdas.
// CHECK-LABEL: define linkonce_odr i32 @_ZZ11inline_funciENKUlvE_clEv
// CHECK: ret i32 1