summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/global-array-destruction.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-11-10 19:24:06 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-11-10 19:24:06 +0000
commit88f4280f6b60edcbdea6a38a3da8b17d66473ad6 (patch)
treefebcfc7a00862cbe41dcb3b5a43c8337b9ffe5d2 /test/CodeGenCXX/global-array-destruction.cpp
parent0854d70dabe11d9b3df6c4b65b9b53a1fd65739e (diff)
This patch implements Code gen. for destruction of
global array of objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/global-array-destruction.cpp')
-rw-r--r--test/CodeGenCXX/global-array-destruction.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/CodeGenCXX/global-array-destruction.cpp b/test/CodeGenCXX/global-array-destruction.cpp
new file mode 100644
index 0000000000..ebea9c156e
--- /dev/null
+++ b/test/CodeGenCXX/global-array-destruction.cpp
@@ -0,0 +1,33 @@
+// 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
+
+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;
+};
+
+
+S arr[2][1];
+S s1;
+S arr1[3];
+static S sarr[4];
+
+int main () {}
+S arr2[2];
+static S sarr1[4];
+S s2;
+S arr3[3];
+
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit
+// CHECK-LP64: call ___cxa_atexit