[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / cxx1z-lambda-star-this.cpp
blob63bfe5603b694c15366f46373c9fef5bee476edd
1 // RUN: %clang_cc1 -std=c++1y -triple i686-pc-windows-msvc -emit-llvm %s -o - | FileCheck %s
2 //CHECK: %[[A_LAMBDA:.*]] = type { %struct.A }
3 //CHECK: %[[B_LAMBDA:.*]] = type { ptr }
4 struct A {
5 double a = 111;
6 auto foo() { return [*this] { return a; }; }
7 };
9 namespace ns1 {
10 int X = A{}.foo()();
11 } //end ns1
13 //CHECK: @"?foo@A@@QAE?A?<auto>@@XZ"(ptr {{[^,]*}} %this, ptr noalias sret(%class.anon) align 8 %[[A_LAMBDA_RETVAL:.*]])
14 // get the first object with the closure type, which is of type 'struct.A'
15 //CHECK: %[[I0:.+]] = getelementptr inbounds %[[A_LAMBDA]], ptr %[[A_LAMBDA_RETVAL]], i32 0, i32 0
16 // copy the contents ...
17 //CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %[[I0]], ptr align 8 %this1, i32 8, i1 false)
19 struct B {
20 double b = 222;
21 auto bar() { return [this] { return b; }; };
24 namespace ns2 {
25 int X = B{}.bar()();
27 //CHECK: @"?bar@B@@QAE?A?<auto>@@XZ"(ptr {{[^,]*}} %this, ptr noalias sret(%class.anon.0) align 4 %agg.result)
28 //CHECK: %[[I20:.+]] = getelementptr inbounds %class.anon.0, ptr %agg.result, i32 0, i32 0
29 //CHECK: store ptr %this1, ptr %[[I20]], align 4