| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
| 2 |
|
| 3 |
typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef; |
| 4 |
typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-error {{'NSObject' attribute takes no arguments}} |
| 5 |
|
| 6 |
static int count; |
| 7 |
static CGColorRef tmp = 0; |
| 8 |
|
| 9 |
typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{'NSObject' attribute is for pointer types only}} |
| 10 |
typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning |
| 11 |
typedef void * CFTypeRef; |
| 12 |
|
| 13 |
@interface HandTested { |
| 14 |
@public |
| 15 |
CGColorRef x; |
| 16 |
} |
| 17 |
|
| 18 |
@property(copy) CGColorRef x; |
| 19 |
typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-warning |
| 20 |
@property (nonatomic, retain) CGColorRefNoNSObject color; |
| 21 |
@property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning |
| 22 |
@property (strong, nullable) CGColorRefNoNSObject color2; // no-warning |
| 23 |
@end |
| 24 |
|
| 25 |
void setProperty(id self, id value) { |
| 26 |
((HandTested *)self)->x = value; |
| 27 |
} |
| 28 |
|
| 29 |
id getProperty(id self) { |
| 30 |
return (id)((HandTested *)self)->x; |
| 31 |
} |
| 32 |
|
| 33 |
@implementation HandTested |
| 34 |
@synthesize x=x; |
| 35 |
@synthesize myObj; |
| 36 |
@dynamic color; |
| 37 |
@end |
| 38 |
|
| 39 |
int main(int argc, char *argv[]) { |
| 40 |
HandTested *to; |
| 41 |
to.x = tmp; // setter |
| 42 |
if (tmp != to.x) |
| 43 |
to.x = tmp; |
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
@interface I |
| 48 |
{ |
| 49 |
__attribute__((NSObject)) void * color; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}} |
| 50 |
} |
| 51 |
@property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; // // no-warning |
| 52 |
@end |
| 53 |
void test_10453342(void) { |
| 54 |
char* __attribute__((NSObject)) string2 = 0; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}} |
| 55 |
} |
| 56 |
|
| 57 |
@interface A { int i; } |
| 58 |
@property(retain) __attribute__((NSObject)) int i; // expected-error {{'NSObject' attribute is for pointer types only}} \ |
| 59 |
// expected-error {{property with 'retain (or strong)' attribute must be of object type}} |
| 60 |
@end |
| 61 |
|
| 62 |
@implementation A |
| 63 |
@synthesize i; |
| 64 |
@end |
| 65 |
|