Since default writable attribute is 'assign', allow

specification of 'assign' (no warning to be issued),
when a continuation class makes a 'readonly' attribute
'readwrite' but also specifies the 'assign' attribute.
(this matches gcc's behavior and prevents exessive 
 warnings)/

llvm-svn: 86297
This commit is contained in:
Fariborz Jahanian 2009-11-06 22:59:12 +00:00
parent b29e155c53
commit 3600f41a3a
2 changed files with 3 additions and 2 deletions

View File

@ -1911,8 +1911,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
unsigned PIkind = PIDecl->getPropertyAttributes();
if (isReadWrite && (PIkind & ObjCPropertyDecl::OBJC_PR_readonly)) {
unsigned assignRetainCopyNonatomic =
(ObjCPropertyDecl::OBJC_PR_assign |
ObjCPropertyDecl::OBJC_PR_retain |
(ObjCPropertyDecl::OBJC_PR_retain |
ObjCPropertyDecl::OBJC_PR_copy |
ObjCPropertyDecl::OBJC_PR_nonatomic);
if ((Attributes & assignRetainCopyNonatomic) !=

View File

@ -7,11 +7,13 @@
}
@property(readonly) id object; // expected-note {{property declared here}}
@property(readwrite, assign) id object1; // expected-note {{property declared here}}
@property (readonly) int indentLevel;
@end
@interface ReadOnly ()
@property(readwrite, copy) id object; // expected-warning {{property attribute in continuation class does not match the primary class}}
@property(readonly) id object1; // expected-error {{property declaration in continuation class of 'ReadOnly' is to change a 'readonly' property to 'readwrite'}}
@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
@end
@protocol Proto