[cfe-commits] r85843 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/continuation-class-err.m
Fariborz Jahanian
fjahanian at apple.com
Mon Nov 2 16:01:39 PST 2009
Author: fjahanian
Date: Mon Nov 2 18:01:38 2009
New Revision: 85843
URL: http://llvm.org/viewvc/llvm-project?rev=85843&view=rev
Log:
Assortment of property attributes declared in continuation
class must match those of same property declared
in its primary class. (Fixes radar 7352425)
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/continuation-class-err.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=85843&r1=85842&r2=85843&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov 2 18:01:38 2009
@@ -1900,9 +1900,16 @@
// 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);
Modified: cfe/trunk/test/SemaObjC/continuation-class-err.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/continuation-class-err.m?rev=85843&r1=85842&r2=85843&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/continuation-class-err.m (original)
+++ cfe/trunk/test/SemaObjC/continuation-class-err.m Mon Nov 2 18:01:38 2009
@@ -5,12 +5,12 @@
id _object;
id _object1;
}
- at property(readonly) id object;
+ at property(readonly) id object; // expected-note {{property declared here}}
@property(readwrite, assign) id object1; // expected-note {{property declared here}}
@end
@interface ReadOnly ()
- at property(readwrite, copy) id object;
+ at 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
More information about the cfe-commits
mailing list