aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/cxx-block-objects.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-11-13 21:53:34 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-11-13 21:53:34 +0000
commit34999876e215b22febc240b1a6dc054215d12f9c (patch)
tree2c0ec2f204edc053fd9fb6e5efc3c0dbbbf709c5 /test/CodeGenCXX/cxx-block-objects.cpp
parentae2cf767de457df939d07c44b162de5fe0b5e607 (diff)
Block API patch to do copy ctor of copied-in cxx objects in
copy helper function and dtor of copied cxx objects in dispose helper functions. __block variables TBD next. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx-block-objects.cpp')
-rw-r--r--test/CodeGenCXX/cxx-block-objects.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cxx-block-objects.cpp b/test/CodeGenCXX/cxx-block-objects.cpp
new file mode 100644
index 0000000000..b989065996
--- /dev/null
+++ b/test/CodeGenCXX/cxx-block-objects.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+// rdar://8594790
+
+extern "C" {
+extern "C" void *_Block_copy(const void *aBlock);
+extern "C" void _Block_release(const void *aBlock);
+}
+
+class A {
+public:
+ int x;
+ A(const A &o);
+ A();
+ virtual ~A();
+ void hello() const;
+};
+
+int
+main()
+{
+ A a;
+ void (^c)(void) = ((__typeof(^{ a.hello(); }))_Block_copy((const void *)(^{ a.hello(); })));
+ c();
+ _Block_release((const void *)(c));
+ return 0;
+}
+
+// CHECK: define internal void @__copy_helper_block_
+// CHECK: call void @_ZN1AC1ERKS_
+
+
+// CHECK:define internal void @__destroy_helper_block_
+// CHECK: call void @_ZN1AD1Ev