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
diff --git a/clang/test/SemaObjC/tentative-property-decl.m b/clang/test/SemaObjC/tentative-property-decl.m
index aa7df52..a9649b6 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>