r200238 - ObjectiveC. When introducing a new property declaration in
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 27 11:14:49 PST 2014
Author: fjahanian
Date: Mon Jan 27 13:14:49 2014
New Revision: 200238
URL: http://llvm.org/viewvc/llvm-project?rev=200238&view=rev
Log:
ObjectiveC. When introducing a new property declaration in
parimary class and in mrr mode, assume property's default
memory attribute (assign) and to prevent a bogus warning.
// rdar://15859862
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/continuation-class-property.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=200238&r1=200237&r2=200238&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Jan 27 13:14:49 2014
@@ -463,6 +463,18 @@ Sema::HandlePropertyInClassExtension(Sco
DeclContext *DC = cast<DeclContext>(CCPrimary);
if (!ObjCPropertyDecl::findPropertyDecl(DC,
PIDecl->getDeclName().getAsIdentifierInfo())) {
+ // In mrr mode, 'readwrite' property must have an explicit
+ // memory attribute. If none specified, select the default (assign).
+ if (!getLangOpts().ObjCAutoRefCount) {
+ if (!(PIkind & (ObjCDeclSpec::DQ_PR_assign |
+ ObjCDeclSpec::DQ_PR_retain |
+ ObjCDeclSpec::DQ_PR_strong |
+ ObjCDeclSpec::DQ_PR_copy |
+ ObjCDeclSpec::DQ_PR_unsafe_unretained |
+ ObjCDeclSpec::DQ_PR_weak)))
+ PIkind |= ObjCPropertyDecl::OBJC_PR_assign;
+ }
+
// Protocol is not in the primary class. Must build one for it.
ObjCDeclSpec ProtocolPropertyODS;
// FIXME. Assuming that ObjCDeclSpec::ObjCPropertyAttributeKind
Modified: cfe/trunk/test/SemaObjC/continuation-class-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/continuation-class-property.m?rev=200238&r1=200237&r2=200238&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/continuation-class-property.m (original)
+++ cfe/trunk/test/SemaObjC/continuation-class-property.m Mon Jan 27 13:14:49 2014
@@ -61,3 +61,15 @@ struct S1;
@property (nonatomic, readwrite, assign) struct S1 *httpRequest3;
@property (nonatomic, readwrite, assign) struct S2 *httpRequest4;
@end
+
+// rdar://15859862
+ at protocol ADCameraJSO_Bindings
+ at property (nonatomic, readonly) NSString *currentPictureURI;
+ at end
+
+ at interface ADCameraJSO
+ at end
+
+ at interface ADCameraJSO() <ADCameraJSO_Bindings>
+ at property (nonatomic, copy) NSString *currentPictureURI;
+ at end
More information about the cfe-commits
mailing list