diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-03 00:01:38 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-03 00:01:38 +0000 |
commit | cc667e2bd2ed7aaf99bc52c58d127644b8ebbfc8 (patch) | |
tree | 04247ce25585efecb6c8be7beb2eaff4047866cc | |
parent | f49ed94751d366dc3fcb3d1197830a49e8b3e0de (diff) |
Assortment of property attributes declared in continuation
class must match those of same property declared
in its primary class. (Fixes radar 7352425)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85843 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 11 | ||||
-rw-r--r-- | test/SemaObjC/continuation-class-err.m | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index f9f01681b9..46c6bf45ad 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1900,9 +1900,16 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, // with continuation class's readwrite property attribute! unsigned PIkind = PIDecl->getPropertyAttributes(); if (isReadWrite && (PIkind & ObjCPropertyDecl::OBJC_PR_readonly)) { - if ((Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) != - (PIkind & ObjCPropertyDecl::OBJC_PR_nonatomic)) + unsigned assignRetainCopyNonatomic = + (ObjCPropertyDecl::OBJC_PR_assign | + ObjCPropertyDecl::OBJC_PR_retain | + ObjCPropertyDecl::OBJC_PR_copy | + ObjCPropertyDecl::OBJC_PR_nonatomic); + if ((Attributes & assignRetainCopyNonatomic) != + (PIkind & assignRetainCopyNonatomic)) { Diag(AtLoc, diag::warn_property_attr_mismatch); + Diag(PIDecl->getLocation(), diag::note_property_declare); + } PIDecl->makeitReadWriteAttribute(); if (Attributes & ObjCDeclSpec::DQ_PR_retain) PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain); diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m index e1ae39bd29..262b786b54 100644 --- a/test/SemaObjC/continuation-class-err.m +++ b/test/SemaObjC/continuation-class-err.m @@ -5,12 +5,12 @@ id _object; id _object1; } -@property(readonly) id object; +@property(readonly) id object; // expected-note {{property declared here}} @property(readwrite, assign) id object1; // expected-note {{property declared here}} @end @interface ReadOnly () -@property(readwrite, copy) id object; +@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'}} @end |