diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-09 06:44:21 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-09 06:44:21 +0000 |
| commit | 2169a75a0aa67dec2424ebf1aaa5be3f8a9c2050 (patch) | |
| tree | ee5cb373bc0c769b51b68ffe077756b85ae8f5a7 /clang/test | |
| parent | e74bc0ef4c4b3149c53ae35b5b3ad7fbb1a385c5 (diff) | |
| download | bcm5719-llvm-2169a75a0aa67dec2424ebf1aaa5be3f8a9c2050.tar.gz bcm5719-llvm-2169a75a0aa67dec2424ebf1aaa5be3f8a9c2050.zip | |
Do a lookup for the blocks runtime globals to see if they were declared,
instead of codegen waiting to consume such a declaration, which won't
happen if that decls are coming from a PCH.
Fixes rdar://10028656.
llvm-svn: 139359
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/PCH/block-decl-merging.c | 28 | ||||
| -rw-r--r-- | clang/test/PCH/block-decl-merging.cpp | 30 |
2 files changed, 58 insertions, 0 deletions
diff --git a/clang/test/PCH/block-decl-merging.c b/clang/test/PCH/block-decl-merging.c new file mode 100644 index 00000000000..9612b2e5228 --- /dev/null +++ b/clang/test/PCH/block-decl-merging.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks %s -emit-pch -o %t +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks %s -include-pch %t -emit-llvm -o - | \ +// RUN: FileCheck %s + +#ifndef HEADER +#define HEADER + +// CHECK: @_NSConcreteGlobalBlock = extern_weak global +extern void * _NSConcreteStackBlock[32] __attribute__((weak_import)); +// CHECK: @_NSConcreteStackBlock = extern_weak global +extern void * _NSConcreteGlobalBlock[32] __attribute__((weak_import)); +extern void _Block_object_dispose(const void *, const int) __attribute__((weak_import)); +// CHECK: declare extern_weak void @_Block_object_assign +extern void _Block_object_assign(void *, const void *, const int) __attribute__((weak_import)); +// CHECK: declare extern_weak void @_Block_object_dispose + +#else + +void *x = ^(){}; + +void f1(void (^a0)(void)); + +void f0() { + __block int x; + f1(^(void){ x = 1; }); +} + +#endif diff --git a/clang/test/PCH/block-decl-merging.cpp b/clang/test/PCH/block-decl-merging.cpp new file mode 100644 index 00000000000..3c0dac63ae2 --- /dev/null +++ b/clang/test/PCH/block-decl-merging.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks %s -emit-pch -o %t +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks %s -include-pch %t -emit-llvm -o - | \ +// RUN: FileCheck %s + +#ifndef HEADER +#define HEADER + +extern "C" { +// CHECK: @_NSConcreteGlobalBlock = extern_weak global +extern void * _NSConcreteStackBlock[32] __attribute__((weak_import)); +// CHECK: @_NSConcreteStackBlock = extern_weak global +extern void * _NSConcreteGlobalBlock[32] __attribute__((weak_import)); +extern void _Block_object_dispose(const void *, const int) __attribute__((weak_import)); +// CHECK: declare extern_weak void @_Block_object_assign +extern void _Block_object_assign(void *, const void *, const int) __attribute__((weak_import)); +// CHECK: declare extern_weak void @_Block_object_dispose +} + +#else + +void *x = ^(){}; + +void f1(void (^a0)(void)); + +void f0() { + __block int x; + f1(^(void){ x = 1; }); +} + +#endif |

