return RD->getIdentifier() == &Ctx.Idents.get("__CFString");
}
-static inline bool isCFRefType(TypedefNameDecl *TD, ASTContext &Ctx) {
+static inline bool isTollFreeBridgeCFRefType(TypedefNameDecl *TD, ASTContext &Ctx) {
StringRef TDName = TD->getIdentifier()->getName();
- return ((TDName.startswith("CF") || TDName.startswith("CG")) &&
- (TDName.rfind("Ref") != StringRef::npos));
+ return (TDName.startswith("CF") && TDName.endswith("Ref"));
}
static unsigned getNumAttributeArgs(const AttributeList &Attr) {
return;
}
// Check for T being a CFType goes here.
- if (!isCFRefType(TD, S.Context)) {
+ if (!isTollFreeBridgeCFRefType(TD, S.Context)) {
S.Diag(TD->getLocStart(), diag::err_objc_bridge_not_cftype);
return;
}
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// rdar://15454846
-typedef struct CGColor * __attribute__ ((objc_bridge(NSError))) CGColorRef;
+typedef struct __CFColor * __attribute__ ((objc_bridge(NSError))) CFColorRef;
-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 __CFMyColor * __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 struct __CFArray * __attribute__ ((objc_bridge)) CFArrayRef; // 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 * __attribute__ ((objc_bridge(NSString))) CFRef;
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 __CFLocale * __attribute__((objc_bridge(NSString, NSError))) CFLocaleRef;// 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 __CFData __attribute__((objc_bridge(NSError))) CFDataRef; // 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))) __CFDictionary * CFDictionaryRef; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
-typedef struct __attribute__((objc_bridge(NSError))) CFColor * CFColorRefNoNSObject1;
+typedef struct __CFObject * CFObjectRef __attribute__((objc_bridge(NSError)));
-typedef union CFUColor * __attribute__((objc_bridge(NSError))) CFColorRefNoNSObject2; // expected-error {{'objc_bridge' attribute only applies to structs}}
+typedef union __CFUColor * __attribute__((objc_bridge(NSError))) CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to structs}}
@interface I
{