diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-13 19:27:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-13 19:27:47 +0000 |
commit | 72c2153b466263a21870b2b1c817900d4981493e (patch) | |
tree | 4a7d8e6a59695a35ff05588e2a26ed708cf158c0 /test/CodeGenCXX/array-operator-delete-call.cpp | |
parent | f8a9a797a4328ca0422a3eff600e1a2074343bc9 (diff) |
Code gen for arrady delete operator. Fixes pr5472.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/array-operator-delete-call.cpp')
-rw-r--r-- | test/CodeGenCXX/array-operator-delete-call.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp new file mode 100644 index 0000000000..d394aa1673 --- /dev/null +++ b/test/CodeGenCXX/array-operator-delete-call.cpp @@ -0,0 +1,52 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s + +extern "C" int printf(...); + +int count; + +struct S { + S() : iS (++count) { printf("S::S(%d)\n", iS); } + ~S() { printf("S::~S(%d)\n", iS); } + int iS; +}; + +struct COST +{ + S *cost; + unsigned *cost_val; + + ~COST(); + COST(); +}; + + +COST::COST() +{ + cost = new S[3]; + cost_val = new unsigned[10]; +} + +COST::~COST() +{ + if (cost) { + delete [] cost; + } + if (cost_val) + delete [] cost_val; +} + +COST c1; + +int main() +{ + COST c3; +} +COST c2; + +// CHECK-LP64: call __ZdaPv + +// CHECK-LP32: call L__ZdaPv + |