aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/array-operator-delete-call.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-11-13 19:27:47 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-11-13 19:27:47 +0000
commit6814eaa2ccf78481d7dae4aa251decadafd20905 (patch)
tree5985f638de455c5e9707c0643048c73ed06c0cad /clang/test/CodeGenCXX/array-operator-delete-call.cpp
parent1fe64cb05955e14324c53b6a4098257765239c72 (diff)
downloadllvm-6814eaa2ccf78481d7dae4aa251decadafd20905.zip
llvm-6814eaa2ccf78481d7dae4aa251decadafd20905.tar.gz
llvm-6814eaa2ccf78481d7dae4aa251decadafd20905.tar.bz2
Code gen for arrady delete operator. Fixes pr5472.
llvm-svn: 88680
Diffstat (limited to 'clang/test/CodeGenCXX/array-operator-delete-call.cpp')
-rw-r--r--clang/test/CodeGenCXX/array-operator-delete-call.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/array-operator-delete-call.cpp b/clang/test/CodeGenCXX/array-operator-delete-call.cpp
new file mode 100644
index 0000000..d394aa1
--- /dev/null
+++ b/clang/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
+