Galina Kistanova | 0ccb31c | 2011-06-03 22:24:54 +0000 | [diff] [blame] | 1 | // REQUIRES: x86-registered-target,x86-64-registered-target |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 3 | // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 5 | // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s |
Fariborz Jahanian | 995d281 | 2009-08-20 01:01:06 +0000 | [diff] [blame] | 6 | |
| 7 | extern "C" int printf(...); |
| 8 | |
| 9 | int i = 1234; |
| 10 | float vf = 1.00; |
| 11 | |
| 12 | struct S { |
| 13 | S() : iS(i++), f1(vf++) {printf("S::S()\n");} |
Fariborz Jahanian | 1c536bf | 2009-08-20 23:02:58 +0000 | [diff] [blame] | 14 | ~S(){printf("S::~S(iS = %d f1 = %f)\n", iS, f1); } |
Fariborz Jahanian | 995d281 | 2009-08-20 01:01:06 +0000 | [diff] [blame] | 15 | int iS; |
| 16 | float f1; |
| 17 | }; |
| 18 | |
| 19 | struct M { |
| 20 | double dM; |
| 21 | S ARR_S[3]; |
| 22 | void pr() { |
| 23 | for (int i = 0; i < 3; i++) |
| 24 | printf("ARR_S[%d].iS = %d ARR_S[%d].f1 = %f\n", i, ARR_S[i].iS, i, ARR_S[i].f1); |
| 25 | |
| 26 | for (int i = 0; i < 2; i++) |
| 27 | for (int j = 0; j < 3; j++) |
| 28 | for (int k = 0; k < 4; k++) |
| 29 | printf("MULTI_ARR[%d][%d][%d].iS = %d MULTI_ARR[%d][%d][%d].f1 = %f\n", |
| 30 | i,j,k, MULTI_ARR[i][j][k].iS, i,j,k, MULTI_ARR[i][j][k].f1); |
| 31 | |
| 32 | } |
| 33 | |
| 34 | S MULTI_ARR[2][3][4]; |
| 35 | }; |
| 36 | |
| 37 | int main() { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 38 | M m1; |
| 39 | m1.pr(); |
Fariborz Jahanian | 995d281 | 2009-08-20 01:01:06 +0000 | [diff] [blame] | 40 | } |
| 41 | |
Sean Callanan | 3b29901 | 2009-12-18 00:04:09 +0000 | [diff] [blame] | 42 | // CHECK-LP64: callq __ZN1SC1Ev |
Fariborz Jahanian | 995d281 | 2009-08-20 01:01:06 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 398e6b9 | 2010-09-22 06:09:31 +0000 | [diff] [blame] | 44 | // CHECK-LP32: calll L__ZN1SC1Ev |