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