2013-11-16 06:18:17 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
|
2013-11-14 07:59:17 +08:00
|
|
|
// rdar://15454846
|
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef struct __CFErrorRef * __attribute__ ((objc_bridge(NSError))) CFErrorRef;
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 08:43:05 +08:00
|
|
|
typedef struct __CFMyColor * __attribute__((objc_bridge(12))) CFMyColorRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 08:43:05 +08:00
|
|
|
typedef struct __CFArray * __attribute__ ((objc_bridge)) CFArrayRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef void * __attribute__ ((objc_bridge(NSURL))) CFURLRef;
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef void * CFStringRef __attribute__ ((objc_bridge(NSString)));
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef struct __CFLocale * __attribute__((objc_bridge(NSLocale, NSError))) CFLocaleRef;// expected-error {{use of undeclared identifier 'NSError'}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute must be applied to a pointer type}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet)));
|
2013-11-14 07:59:17 +08:00
|
|
|
|
2013-11-14 09:00:26 +08:00
|
|
|
typedef union __CFUColor * __attribute__((objc_bridge(NSUColor))) CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to structs}}
|
2013-11-14 07:59:17 +08:00
|
|
|
|
|
|
|
@interface I
|
|
|
|
{
|
|
|
|
__attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
|
|
|
|
|
|
|
|
}
|
|
|
|
@end
|
2013-11-16 06:18:17 +08:00
|
|
|
|
|
|
|
@protocol NSTesting @end
|
|
|
|
@class NSString;
|
|
|
|
|
|
|
|
typedef struct __CFError * __attribute__((objc_bridge(NSTesting))) CFTestingRef; // expected-note {{declared here}}
|
|
|
|
|
|
|
|
id foo(CFTestingRef cf) {
|
|
|
|
return (NSString *)cf; // expected-error {{CF object of type 'CFTestingRef' (aka 'struct __CFError *') with 'objc_bridge' attribute which has parameter that does not name an Objective-C class}}
|
|
|
|
}
|