From: Fariborz Jahanian Date: Fri, 6 Nov 2009 22:59:12 +0000 (+0000) Subject: Since default writable attribute is 'assign', allow X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d669be595aa3a9be05edffa56d0e713d58f80823;p=clang 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)/ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86297 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 93f8d0dc37..455671596f 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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) != diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m index 262b786b54..4559696b7f 100644 --- a/test/SemaObjC/continuation-class-err.m +++ b/test/SemaObjC/continuation-class-err.m @@ -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