r284933 - Fix mangling numbers for varargs lambdas; varargs and non-varargs lambdas get
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 22 21:53:03 PDT 2016
Author: rsmith
Date: Sat Oct 22 23:53:03 2016
New Revision: 284933
URL: http://llvm.org/viewvc/llvm-project?rev=284933&view=rev
Log:
Fix mangling numbers for varargs lambdas; varargs and non-varargs lambdas get
different lambda-sigs, so they should have different counters.
Modified:
cfe/trunk/lib/AST/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp
Modified: cfe/trunk/lib/AST/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumCXXABI.cpp?rev=284933&r1=284932&r2=284933&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumCXXABI.cpp Sat Oct 22 23:53:03 2016
@@ -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>()];
}
Modified: cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp?rev=284933&r1=284932&r2=284933&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-lambdas.cpp Sat Oct 22 23:53:03 2016
@@ -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
More information about the cfe-commits
mailing list