have correct pointer type or issue error,
instead of crashing in IRGen. // rdar://
11569860
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157780
91177308-0d34-0410-b5e6-
96231b3b80d8
return;
}
}
- else if (!isa<ObjCPropertyDecl>(D)) {
+ else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) {
+ QualType T = PD->getType();
+ if (!T->isPointerType() ||
+ !T->getAs<PointerType>()->getPointeeType()->isRecordType()) {
+ S.Diag(PD->getLocation(), diag::err_nsobject_attribute);
+ return;
+ }
+ }
+ else {
// It is okay to include this attribute on properties, e.g.:
//
// @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
__attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
}
// <rdar://problem/10930507>
-@property (nonatomic, retain) __attribute__((NSObject)) void * color; // // no-warning
+@property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; // // no-warning
@end
void test_10453342() {
char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}}
}
+// rdar://11569860
+@interface A { int i; }
+@property(retain) __attribute__((NSObject)) int i; // expected-error {{__attribute ((NSObject)) is for pointer types only}} \
+ // expected-error {{property with 'retain (or strong)' attribute must be of object type}}
+@end
+
+@implementation A
+@synthesize i;
+@end
+