"'objc_bridge' attribute must be put on a typedef only">;
def err_objc_bridge_not_cftype : Error<
"'objc_bridge' attribute must be applied to definition of CF types">;
-def err_objc_bridge_not_pointertype : Error<
- "'objc_bridge' attribute must be applied to a pointer type">;
+def err_objc_bridge_not_pointert_to_struct : Error<
+ "'objc_bridge' attribute must be applied to a pointer to struct type">;
def err_objc_bridged_not_interface : Error<
- "CF object of type %0 with 'objc_bridge' attribute which has parameter that"
- " does not name an Objective-C class">;
+ "CF object of type %0 is bridged to '%1', which is not an Objective-C class">;
// Function Parameter Semantic Analysis.
def err_param_with_void_type : Error<"argument may not have 'void' type">;
if (T->isRecordType()) {
RecordDecl *RD = T->getAs<RecordType>()->getDecl();
if (!RD || RD->isUnion()) {
- S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type)
- << Attr.getRange() << Attr.getName() << ExpectedStruct;
+ S.Diag(D->getLocStart(), diag::err_objc_bridge_not_pointert_to_struct)
+ << Attr.getRange();
return;
}
+ } else {
+ S.Diag(TD->getLocStart(), diag::err_objc_bridge_not_pointert_to_struct)
+ << Attr.getRange();
+ return;
}
} else {
- S.Diag(TD->getLocStart(), diag::err_objc_bridge_not_pointertype);
+ S.Diag(TD->getLocStart(), diag::err_objc_bridge_not_pointert_to_struct)
+ << Attr.getRange();
return;
}
// Check for T being a CFType goes here.
NamedDecl *Target = R.getFoundDecl();
if (Target && !isa<ObjCInterfaceDecl>(Target)) {
S.Diag(castExpr->getLocStart(), diag::err_objc_bridged_not_interface)
- << castExpr->getType();
+ << castExpr->getType() << Parm->getName();
S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
S.Diag(Target->getLocStart(), diag::note_declared_at);
}
} else {
S.Diag(castExpr->getLocStart(), diag::err_objc_bridged_not_interface)
- << castExpr->getType();
+ << castExpr->getType() << Parm->getName();
S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
}
}
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(NSURL))) CFURLRef;
+typedef void * __attribute__ ((objc_bridge(NSURL))) CFURLRef; // expected-error {{'objc_bridge' attribute must be applied to a pointer to struct type}}
-typedef void * CFStringRef __attribute__ ((objc_bridge(NSString)));
+typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute must be applied to a pointer to struct type}}
typedef struct __CFLocale * __attribute__((objc_bridge(NSLocale, NSError))) CFLocaleRef;// expected-error {{use of undeclared identifier 'NSError'}}
-typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute must be applied to a pointer type}}
+typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute must be applied to a pointer to struct type}}
typedef struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef; // expected-error {{'objc_bridge' attribute must be put on a typedef only}}
typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet)));
-typedef union __CFUColor * __attribute__((objc_bridge(NSUColor))) CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to structs}}
+typedef union __CFUColor * __attribute__((objc_bridge(NSUColor))) CFUColorRef; // expected-error {{'objc_bridge' attribute must be applied to a pointer to struct type}}
@interface I
{
typedef struct __CFError * __attribute__((objc_bridge(NSTesting))) CFTestingRef; // expected-note {{declared here}}
id Test1(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}}
+ return (NSString *)cf; // expected-error {{CF object of type 'CFTestingRef' (aka 'struct __CFError *') is bridged to 'NSTesting', which is not an Objective-C class}}
}
typedef CFErrorRef CFErrorRef1;