diff options
Diffstat (limited to 'test/CodeGenCXX/lambda-expressions.cpp')
-rw-r--r-- | test/CodeGenCXX/lambda-expressions.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/test/CodeGenCXX/lambda-expressions.cpp b/test/CodeGenCXX/lambda-expressions.cpp index 49b9efb..28a8841 100644 --- a/test/CodeGenCXX/lambda-expressions.cpp +++ b/test/CodeGenCXX/lambda-expressions.cpp @@ -19,11 +19,11 @@ int a() { return []{ return 1; }(); } int b(int x) { return [x]{return x;}(); } // CHECK-LABEL: define i32 @_Z1bi // CHECK: store i32 -// CHECK: load i32* +// CHECK: load i32, i32* // CHECK: store i32 // CHECK: call i32 @"_ZZ1biENK3$_1clEv" // CHECK-LABEL: define internal i32 @"_ZZ1biENK3$_1clEv" -// CHECK: load i32* +// CHECK: load i32, i32* // CHECK: ret i32 int c(int x) { return [&x]{return x;}(); } @@ -32,8 +32,8 @@ int c(int x) { return [&x]{return x;}(); } // CHECK: store i32* // CHECK: call i32 @"_ZZ1ciENK3$_2clEv" // CHECK-LABEL: define internal i32 @"_ZZ1ciENK3$_2clEv" -// CHECK: load i32** -// CHECK: load i32* +// CHECK: load i32*, i32** +// CHECK: load i32, i32* // CHECK: ret i32 struct D { D(); D(const D&); int x; }; @@ -45,8 +45,8 @@ int d(int x) { D y[10]; [x,y] { return y[x].x; }(); } // CHECK: call void @_ZN1DC1ERKS_ // CHECK: call i32 @"_ZZ1diENK3$_3clEv" // CHECK-LABEL: define internal i32 @"_ZZ1diENK3$_3clEv" -// CHECK: load i32* -// CHECK: load i32* +// CHECK: load i32, i32* +// CHECK: load i32, i32* // CHECK: ret i32 struct E { E(); E(const E&); ~E(); int x; }; @@ -60,7 +60,7 @@ int e(E a, E b, bool cond) { [a,b,cond](){ return (cond ? a : b).x; }(); } // CHECK-LABEL: define internal i32 @"_ZZ1e1ES_bENK3$_4clEv" // CHECK: trunc i8 -// CHECK: load i32* +// CHECK: load i32, i32* // CHECK: ret i32 void f() { @@ -76,12 +76,12 @@ int g() { int &r = k; // CHECK-LABEL: define internal i32 @"_ZZ1gvENK3$_6clEv"( // CHECK-NOT: } - // CHECK: load i32* @_ZL1k, + // CHECK: load i32, i32* @_ZL1k, return [] { return r; } (); }; // PR14773 -// CHECK: [[ARRVAL:%[0-9a-zA-Z]*]] = load i32* getelementptr inbounds ([0 x i32]* @_ZZ14staticarrayrefvE5array, i32 0, i64 0), align 4 +// CHECK: [[ARRVAL:%[0-9a-zA-Z]*]] = load i32, i32* getelementptr inbounds ([0 x i32], [0 x i32]* @_ZZ14staticarrayrefvE5array, i32 0, i64 0), align 4 // CHECK-NEXT: store i32 [[ARRVAL]] void staticarrayref(){ static int array[] = {}; @@ -99,24 +99,24 @@ int *PR22071_fun() { return [&] { return &y; }(); } -// CHECK: define internal void @"_ZZ1hvEN3$_98__invokeEv"(%struct.A* noalias sret %agg.result) {{.*}} { -// CHECK-NOT: = -// CHECK: call void @"_ZZ1hvENK3$_9clEv"(%struct.A* sret %agg.result, -// CHECK-NEXT: ret void -struct A { ~A(); }; -void h() { - A (*h)() = [] { return A(); }; -} +// CHECK-LABEL: define internal void @"_ZZ1e1ES_bEN3$_4D2Ev" // CHECK-LABEL: define internal i32 @"_ZZ1fvEN3$_58__invokeEii" // CHECK: store i32 // CHECK-NEXT: store i32 -// CHECK-NEXT: load i32* -// CHECK-NEXT: load i32* +// CHECK-NEXT: load i32, i32* +// CHECK-NEXT: load i32, i32* // CHECK-NEXT: call i32 @"_ZZ1fvENK3$_5clEii" // CHECK-NEXT: ret i32 -// CHECK-LABEL: define internal void @"_ZZ1e1ES_bEN3$_4D2Ev" +// CHECK-LABEL: define internal void @"_ZZ1hvEN3$_98__invokeEv"(%struct.A* noalias sret %agg.result) {{.*}} { +// CHECK-NOT: = +// CHECK: call void @"_ZZ1hvENK3$_9clEv"(%struct.A* sret %agg.result, +// CHECK-NEXT: ret void +struct A { ~A(); }; +void h() { + A (*h)() = [] { return A(); }; +} // <rdar://problem/12778708> struct XXX {}; @@ -128,3 +128,12 @@ void nestedCapture () { }; }; } + +// Ensure we don't assert here. +struct CaptureArrayAndThis { + CaptureArrayAndThis() { + char array[] = "floop"; + [array, this] {}; + } +} capture_array_and_this; + |