summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-11-13 23:59:17 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-11-13 23:59:17 +0000
commit0a0a39708c6a879db82562f094259906b3587a93 (patch)
treee5cac5f320e6710e433cbc0e8a46917ad24c7022 /clang/test
parent415ef6db6877c989087cc631c279d4452710b2a6 (diff)
downloadbcm5719-llvm-0a0a39708c6a879db82562f094259906b3587a93.tar.gz
bcm5719-llvm-0a0a39708c6a879db82562f094259906b3587a93.zip
ObjectiveC ARC. Introduce a new attribute, 'objc_bridge'
that teaches the compiler about a subset of toll-free bridging semantics. This is wip. // rdar://15454846 llvm-svn: 194633
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/objcbridge-attribute.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/objcbridge-attribute.m b/clang/test/SemaObjC/objcbridge-attribute.m
new file mode 100644
index 00000000000..797f00be546
--- /dev/null
+++ b/clang/test/SemaObjC/objcbridge-attribute.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// rdar://15454846
+
+typedef struct CGColor * __attribute__ ((objc_bridge(NSError))) CGColorRef;
+
+typedef struct CGColor * __attribute__((objc_bridge(12))) CFMyColorRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
+
+typedef struct S1 * __attribute__ ((objc_bridge)) CGColorRef1; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
+
+typedef void * __attribute__ ((objc_bridge(NSString))) CGColorRef2;
+
+typedef void * CFTypeRef __attribute__ ((objc_bridge(NSError)));
+
+typedef struct CGColor * __attribute__((objc_bridge(NSString, NSError))) CGColorRefNoNSObject;// expected-error {{use of undeclared identifier 'NSError'}}
+
+typedef struct CGColor __attribute__((objc_bridge(NSError))) CGColorRefNoNSObject2; // expected-error {{'objc_bridge' attribute must be applied to a pointer type}}
+
+typedef struct __attribute__((objc_bridge(NSError))) CFColor * CFColorRefNoNSObject; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
+
+typedef struct __attribute__((objc_bridge(NSError))) CFColor * CFColorRefNoNSObject1;
+
+typedef union CFUColor * __attribute__((objc_bridge(NSError))) CFColorRefNoNSObject2; // expected-error {{'objc_bridge' attribute only applies to structs}}
+
+@interface I
+{
+ __attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
+
+}
+@end
OpenPOWER on IntegriCloud