From 72c2153b466263a21870b2b1c817900d4981493e Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 13 Nov 2009 19:27:47 +0000 Subject: 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 --- test/CodeGenCXX/array-operator-delete-call.cpp | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/CodeGenCXX/array-operator-delete-call.cpp (limited to 'test/CodeGenCXX/array-operator-delete-call.cpp') 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 + -- cgit v1.2.3-70-g09d2