Richard Smith | 1664d54 | 2012-04-22 05:51:36 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | FileCheck %s |
Fariborz Jahanian | 88f4280 | 2009-11-10 19:24:06 +0000 | [diff] [blame] | 2 | |
| 3 | extern "C" int printf(...); |
| 4 | |
| 5 | int count; |
| 6 | |
| 7 | struct S { |
| 8 | S() : iS(++count) { printf("S::S(%d)\n", iS); } |
| 9 | ~S() { printf("S::~S(%d)\n", iS); } |
| 10 | int iS; |
| 11 | }; |
| 12 | |
| 13 | |
| 14 | S arr[2][1]; |
| 15 | S s1; |
| 16 | S arr1[3]; |
| 17 | static S sarr[4]; |
| 18 | |
| 19 | int main () {} |
| 20 | S arr2[2]; |
| 21 | static S sarr1[4]; |
| 22 | S s2; |
| 23 | S arr3[3]; |
| 24 | |
Richard Smith | 1664d54 | 2012-04-22 05:51:36 +0000 | [diff] [blame] | 25 | // CHECK: call {{.*}} @__cxa_atexit |
| 26 | // CHECK: call {{.*}} @__cxa_atexit |
| 27 | // CHECK: call {{.*}} @__cxa_atexit |
| 28 | // CHECK: call {{.*}} @__cxa_atexit |
| 29 | // CHECK: call {{.*}} @__cxa_atexit |
| 30 | // CHECK: call {{.*}} @__cxa_atexit |
| 31 | // CHECK: call {{.*}} @__cxa_atexit |
| 32 | // CHECK: call {{.*}} @__cxa_atexit |
| 33 | |
| 34 | struct T { |
| 35 | double d; |
| 36 | int n; |
| 37 | ~T(); |
| 38 | }; |
| 39 | T t[2][3] = { 1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10, 11.0, 12 }; |
| 40 | |
| 41 | // CHECK: call {{.*}} @__cxa_atexit |
| 42 | // CHECK: getelementptr inbounds ({{.*}} bitcast {{.*}}* @t to %struct.T*), i64 6 |
| 43 | // CHECK: call void @_ZN1TD1Ev |
| 44 | // CHECK: icmp eq {{.*}} @t |
| 45 | // CHECK: br i1 {{.*}} |
Richard Smith | 5f9a7e3 | 2012-11-12 21:38:00 +0000 | [diff] [blame] | 46 | |
| 47 | static T t2[2][3] = { 1.0, 2, 3.0, 4, 5.0, 6, 7.0, 8, 9.0, 10, 11.0, 12 }; |
| 48 | |
| 49 | // CHECK: call {{.*}} @__cxa_atexit |
| 50 | // CHECK: getelementptr inbounds ({{.*}} bitcast {{.*}}* @_ZL2t2 to %struct.T*), i64 6 |
| 51 | // CHECK: call void @_ZN1TD1Ev |
| 52 | // CHECK: icmp eq {{.*}} @_ZL2t |
| 53 | // CHECK: br i1 {{.*}} |
Richard Smith | 802e226 | 2013-02-02 01:13:06 +0000 | [diff] [blame] | 54 | |
| 55 | using U = T[2][3]; |
| 56 | U &&u = U{ {{1.0, 2}, {3.0, 4}, {5.0, 6}}, {{7.0, 8}, {9.0, 10}, {11.0, 12}} }; |
| 57 | |
| 58 | // CHECK: call {{.*}} @__cxa_atexit |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 59 | // CHECK: getelementptr inbounds ({{.*}}* getelementptr inbounds ([2 x [3 x {{.*}}]], [2 x [3 x {{.*}}]]* @_ZGR1u_, i32 0, i32 0, i32 0), i64 6) |
Richard Smith | 802e226 | 2013-02-02 01:13:06 +0000 | [diff] [blame] | 60 | // CHECK: call void @_ZN1TD1Ev |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 61 | // CHECK: icmp eq {{.*}} @_ZGR1u_ |
Richard Smith | 802e226 | 2013-02-02 01:13:06 +0000 | [diff] [blame] | 62 | // CHECK: br i1 {{.*}} |