xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/array-construction.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // REQUIRES: x86-registered-target,x86-64-registered-target
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
3*f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
5*f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc extern "C" int printf(...);
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc static int count;
10*f4a2713aSLionel Sambuc static float fcount;
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc class xpto {
13*f4a2713aSLionel Sambuc public:
14*f4a2713aSLionel Sambuc   xpto() : i(count++), f(fcount++) {
15*f4a2713aSLionel Sambuc     printf("xpto::xpto()\n");
16*f4a2713aSLionel Sambuc   }
17*f4a2713aSLionel Sambuc   int i;
18*f4a2713aSLionel Sambuc   float f;
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc   ~xpto() {
21*f4a2713aSLionel Sambuc     printf("xpto::~xpto()\n");
22*f4a2713aSLionel Sambuc   }
23*f4a2713aSLionel Sambuc };
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc int main() {
26*f4a2713aSLionel Sambuc   xpto array[2][3][4];
27*f4a2713aSLionel Sambuc   for (int h = 0; h < 2; h++)
28*f4a2713aSLionel Sambuc    for (int i = 0; i < 3; i++)
29*f4a2713aSLionel Sambuc     for (int j = 0; j < 4; j++)
30*f4a2713aSLionel Sambuc        printf("array[%d][%d][%d] = {%d, %f}\n",
31*f4a2713aSLionel Sambuc               h, i, j, array[h][i][j].i, array[h][i][j].f);
32*f4a2713aSLionel Sambuc }
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc // CHECK-LP64: callq    __ZN4xptoC1Ev
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc // CHECK-LP32: calll     L__ZN4xptoC1Ev
37*f4a2713aSLionel Sambuc 
38