[llvm-commits] [test-suite] r135347 - /test-suite/trunk/SingleSource/UnitTests/block-byref-test.c
Fariborz Jahanian
fjahanian at apple.com
Sat Jul 16 10:24:05 PDT 2011
Author: fjahanian
Date: Sat Jul 16 12:24:05 2011
New Revision: 135347
URL: http://llvm.org/viewvc/llvm-project?rev=135347&view=rev
Log:
A useful test for //rdar://9778214
Added:
test-suite/trunk/SingleSource/UnitTests/block-byref-test.c
Added: test-suite/trunk/SingleSource/UnitTests/block-byref-test.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/block-byref-test.c?rev=135347&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/block-byref-test.c (added)
+++ test-suite/trunk/SingleSource/UnitTests/block-byref-test.c Sat Jul 16 12:24:05 2011
@@ -0,0 +1,28 @@
+#if defined(__BLOCKS__)
+extern void abort();
+
+int main() {
+ __block unsigned char b1bool = 0;
+ unsigned char *b1boolref = &b1bool;
+ void(^b1)(void) = ^ {
+ if (b1bool != 1)
+ abort();
+ };
+ *b1boolref = 1;
+ b1();
+
+ __block unsigned char b2bool = 0;
+ void(^b2)(void) = ^ {
+ if (b2bool != 1)
+ abort();
+ };
+ unsigned char *b2boolref = &b2bool;
+ *b2boolref = 1;
+ b2();
+ return 0;
+}
+#else
+int main() {
+ return 0;
+}
+#endif
More information about the llvm-commits
mailing list