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 | // rdar://12103400 |
4 | |
5 | @class NSString; |
6 | |
7 | @interface MyClass |
8 | |
9 | @property (nonatomic, readonly) NSString* addingMemoryModel; |
10 | |
11 | @property (nonatomic, copy, readonly) NSString* matchingMemoryModel; |
12 | |
13 | @property (atomic, retain, readonly) NSString* addingNoNewMemoryModel; |
14 | |
15 | @property (readonly) NSString* none; |
16 | @property (readonly) NSString* none1; |
17 | |
18 | @property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}} |
19 | |
20 | @property (readonly) __weak id weak_prop; |
21 | @property (readonly) __weak id weak_prop1; |
22 | |
23 | @property (assign, readonly) NSString* assignProperty; |
24 | |
25 | @property (readonly) NSString* readonlyProp; |
26 | |
27 | |
28 | |
29 | @end |
30 | |
31 | @interface MyClass () |
32 | { |
33 | NSString* _name; |
34 | } |
35 | |
36 | @property (nonatomic, copy) NSString* addingMemoryModel; |
37 | @property (nonatomic, copy) NSString* matchingMemoryModel; |
38 | @property () NSString* addingNoNewMemoryModel; |
39 | @property () NSString* none; |
40 | @property (readwrite, retain) NSString* none1; |
41 | |
42 | @property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}} |
43 | @property () __weak id weak_prop; |
44 | @property (readwrite) __weak id weak_prop1; |
45 | |
46 | @property (assign, readwrite) NSString* assignProperty; |
47 | @property (assign) NSString* readonlyProp; |
48 | @end |
49 | |
50 | // rdar://12214070 |
51 | @interface radar12214070 |
52 | @property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} |
53 | |
54 | @property (nonatomic, readonly) float propertyName2; // expected-note {{property declared here}} |
55 | @end |
56 | |
57 | @interface radar12214070 () |
58 | @property (atomic, nonatomic, readonly, readwrite) float propertyName; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} \ |
59 | // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}} |
60 | |
61 | @property (atomic, readwrite) float propertyName2; // expected-warning {{'atomic' attribute on property 'propertyName2' does not match the property inherited from 'radar12214070'}} |
62 | @end |
63 | |
64 | |