Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 2 | // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 4 | // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s |
| 5 | |
| 6 | extern "C" int printf(...); |
| 7 | |
| 8 | int count; |
| 9 | |
| 10 | struct S { |
| 11 | S() : iS (++count) { printf("S::S(%d)\n", iS); } |
| 12 | ~S() { printf("S::~S(%d)\n", iS); } |
| 13 | int iS; |
| 14 | }; |
| 15 | |
Fariborz Jahanian | 534ba90 | 2009-11-13 22:29:45 +0000 | [diff] [blame] | 16 | struct V { |
| 17 | V() : iV (++count) { printf("V::V(%d)\n", iV); } |
| 18 | virtual ~V() { printf("V::~V(%d)\n", iV); } |
| 19 | int iV; |
| 20 | }; |
| 21 | |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 22 | struct COST |
| 23 | { |
| 24 | S *cost; |
Fariborz Jahanian | 534ba90 | 2009-11-13 22:29:45 +0000 | [diff] [blame] | 25 | V *vcost; |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 26 | unsigned *cost_val; |
| 27 | |
| 28 | ~COST(); |
| 29 | COST(); |
| 30 | }; |
| 31 | |
| 32 | |
| 33 | COST::COST() |
| 34 | { |
| 35 | cost = new S[3]; |
Fariborz Jahanian | 534ba90 | 2009-11-13 22:29:45 +0000 | [diff] [blame] | 36 | vcost = new V[4]; |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 37 | cost_val = new unsigned[10]; |
| 38 | } |
| 39 | |
| 40 | COST::~COST() |
| 41 | { |
| 42 | if (cost) { |
| 43 | delete [] cost; |
| 44 | } |
Fariborz Jahanian | 534ba90 | 2009-11-13 22:29:45 +0000 | [diff] [blame] | 45 | if (vcost) { |
| 46 | delete [] vcost; |
| 47 | } |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 48 | if (cost_val) |
| 49 | delete [] cost_val; |
| 50 | } |
| 51 | |
| 52 | COST c1; |
| 53 | |
| 54 | int main() |
| 55 | { |
| 56 | COST c3; |
| 57 | } |
| 58 | COST c2; |
| 59 | |
Sean Callanan | 3b29901 | 2009-12-18 00:04:09 +0000 | [diff] [blame] | 60 | // CHECK-LP64: callq __ZdaPv |
Fariborz Jahanian | 72c2153 | 2009-11-13 19:27:47 +0000 | [diff] [blame] | 61 | |
| 62 | // CHECK-LP32: call L__ZdaPv |
| 63 | |