| 1 |
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -verify -Wproperty-attribute-mismatch %s |
| 2 |
// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Wproperty-attribute-mismatch %s |
| 3 |
|
| 4 |
@class NSString; |
| 5 |
|
| 6 |
@interface MyClass |
| 7 |
|
| 8 |
@property (nonatomic, readonly) NSString* addingMemoryModel; |
| 9 |
|
| 10 |
@property (nonatomic, copy, readonly) NSString* matchingMemoryModel; |
| 11 |
|
| 12 |
@property (atomic, retain, readonly) NSString* addingNoNewMemoryModel; |
| 13 |
|
| 14 |
@property (readonly) NSString* none; |
| 15 |
@property (readonly) NSString* none1; |
| 16 |
|
| 17 |
@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}} |
| 18 |
|
| 19 |
@property (readonly) __weak id weak_prop; |
| 20 |
@property (readonly) __weak id weak_prop1; |
| 21 |
|
| 22 |
@property (assign, readonly) NSString* assignProperty; |
| 23 |
|
| 24 |
@property (readonly) NSString* readonlyProp; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
@end |
| 29 |
|
| 30 |
@interface MyClass () |
| 31 |
{ |
| 32 |
NSString* _name; |
| 33 |
} |
| 34 |
|
| 35 |
@property (nonatomic, copy) NSString* addingMemoryModel; |
| 36 |
@property (nonatomic, copy) NSString* matchingMemoryModel; |
| 37 |
@property () NSString* addingNoNewMemoryModel; |
| 38 |
@property () NSString* none; |
| 39 |
@property (readwrite, retain) NSString* none1; |
| 40 |
|
| 41 |
@property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}} |
| 42 |
@property () __weak id weak_prop; |
| 43 |
@property (readwrite) __weak id weak_prop1; |
| 44 |
|
| 45 |
@property (assign, readwrite) NSString* assignProperty; |
| 46 |
@property (assign) NSString* readonlyProp; |
| 47 |
@end |
| 48 |
|
| 49 |
@interface radar12214070 |
| 50 |
@property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} |
| 51 |
|
| 52 |
@property (nonatomic, readonly) float propertyName2; // expected-note {{property declared here}} |
| 53 |
@end |
| 54 |
|
| 55 |
@interface radar12214070 () |
| 56 |
@property (atomic, nonatomic, readonly, readwrite) float propertyName; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} \ |
| 57 |
// expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} |
| 58 |
|
| 59 |
@property (atomic, readwrite) float propertyName2; // expected-warning {{'atomic' attribute on property 'propertyName2' does not match the property inherited from 'radar12214070'}} |
| 60 |
@end |
| 61 |
|