diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2013-12-13 18:19:59 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-12-13 18:19:59 +0000 |
| commit | 059021a36937788d4951b74a663f0a0621aa85bc (patch) | |
| tree | 753a9c1ab18556d84a06148b2c8de43ffa8654a7 /clang/test | |
| parent | e139dd4fe658b8615a5613cda2096d293107b7b1 (diff) | |
| download | bcm5719-llvm-059021a36937788d4951b74a663f0a0621aa85bc.tar.gz bcm5719-llvm-059021a36937788d4951b74a663f0a0621aa85bc.zip | |
Objective-C. Do not issue warning when 'readonly'
property declaration has a memory management
attribute (retain, copy, etc.). Sich properties
are usually overridden to become 'readwrite'
via a class extension (which require the memory
management attribute specified). In the absence of class
extension override, memory management attribute is
needed to produce correct Code Gen. for the
property getter in any case and this warning becomes
confusing to user. // rdar://15641300
llvm-svn: 197251
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaObjC/overriding-property-in-class-extension.m | 3 | ||||
| -rw-r--r-- | clang/test/SemaObjC/property-12.m | 8 | ||||
| -rw-r--r-- | clang/test/SemaObjC/property-in-class-extension-1.m | 9 | ||||
| -rw-r--r-- | clang/test/SemaObjC/tentative-property-decl.m | 15 |
4 files changed, 18 insertions, 17 deletions
diff --git a/clang/test/SemaObjC/overriding-property-in-class-extension.m b/clang/test/SemaObjC/overriding-property-in-class-extension.m index 8c0e1b98a57..77efd556928 100644 --- a/clang/test/SemaObjC/overriding-property-in-class-extension.m +++ b/clang/test/SemaObjC/overriding-property-in-class-extension.m @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Weverything %s +// expected-no-diagnostics // rdar://12103434 @class NSString; @@ -7,7 +8,7 @@ @interface MyClass : NSObject -@property (nonatomic, copy, readonly) NSString* name; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} +@property (nonatomic, copy, readonly) NSString* name; @end diff --git a/clang/test/SemaObjC/property-12.m b/clang/test/SemaObjC/property-12.m index c4a75555562..5fc311aa90a 100644 --- a/clang/test/SemaObjC/property-12.m +++ b/clang/test/SemaObjC/property-12.m @@ -1,15 +1,15 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -Wreadonly-setter-attrs -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s @protocol P0 -@property(readonly,assign) id X; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}} +@property(readonly,assign) id X; @end @protocol P1 -@property(readonly,retain) id X; // expected-warning {{property attributes 'readonly' and 'retain' are mutually exclusive}} +@property(readonly,retain) id X; @end @protocol P2 -@property(readonly,copy) id X; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} +@property(readonly,copy) id X; @end @protocol P3 diff --git a/clang/test/SemaObjC/property-in-class-extension-1.m b/clang/test/SemaObjC/property-in-class-extension-1.m index 51837fd212c..ab461ef6c19 100644 --- a/clang/test/SemaObjC/property-in-class-extension-1.m +++ b/clang/test/SemaObjC/property-in-class-extension-1.m @@ -8,20 +8,19 @@ @property (nonatomic, readonly) NSString* addingMemoryModel; -@property (nonatomic, copy, readonly) NSString* matchingMemoryModel; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} +@property (nonatomic, copy, readonly) NSString* matchingMemoryModel; -@property (nonatomic, retain, readonly) NSString* addingNoNewMemoryModel; // expected-warning {{property attributes 'readonly' and 'retain' are mutually exclusive}} +@property (nonatomic, retain, readonly) NSString* addingNoNewMemoryModel; @property (readonly) NSString* none; @property (readonly) NSString* none1; -@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}} \ - // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}} +@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}} @property (readonly) __weak id weak_prop; @property (readonly) __weak id weak_prop1; -@property (assign, readonly) NSString* assignProperty; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}} +@property (assign, readonly) NSString* assignProperty; @property (readonly) NSString* readonlyProp; diff --git a/clang/test/SemaObjC/tentative-property-decl.m b/clang/test/SemaObjC/tentative-property-decl.m index aa7df5294a8..a9649b644c3 100644 --- a/clang/test/SemaObjC/tentative-property-decl.m +++ b/clang/test/SemaObjC/tentative-property-decl.m @@ -1,10 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only -Weverything -verify %s +// expected-no-diagnostics // rdar://11656982 -/** Normally, a property cannot be both 'readonly' and having a "write" attribute +/** A property may not be both 'readonly' and having a memory management attribute (copy/retain/etc.). But, property declaration in primary class and protcols are tentative as they may be overridden into a 'readwrite' property in class - extensions. Postpone diagnosing such warnings until the class implementation - is seen. + extensions. So, do not issue any warning on 'readonly' and memory management + attributes in a property. */ @interface Super { @@ -14,8 +15,8 @@ @class NSString; @interface MyClass : Super -@property(nonatomic, copy, readonly) NSString *prop; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} -@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} +@property(nonatomic, copy, readonly) NSString *prop; +@property(nonatomic, copy, readonly) id warnProp; @end @interface MyClass () @@ -29,8 +30,8 @@ @protocol P -@property(nonatomic, copy, readonly) NSString *prop; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} -@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}} +@property(nonatomic, copy, readonly) NSString *prop; +@property(nonatomic, copy, readonly) id warnProp; @end @interface YourClass : Super <P> |

