From: Fariborz Jahanian Date: Mon, 27 Jan 2014 19:14:49 +0000 (+0000) Subject: ObjectiveC. When introducing a new property declaration in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=359bfa80ed8d2cf924d2e50dab8dad7d694d6d14;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200238 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index beb58ecdfa..c8358bccb6 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -463,6 +463,18 @@ Sema::HandlePropertyInClassExtension(Scope *S, DeclContext *DC = cast(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 diff --git a/test/SemaObjC/continuation-class-property.m b/test/SemaObjC/continuation-class-property.m index 2a8e5085fe..83aa796309 100644 --- a/test/SemaObjC/continuation-class-property.m +++ b/test/SemaObjC/continuation-class-property.m @@ -61,3 +61,15 @@ struct S1; @property (nonatomic, readwrite, assign) struct S1 *httpRequest3; @property (nonatomic, readwrite, assign) struct S2 *httpRequest4; @end + +// rdar://15859862 +@protocol ADCameraJSO_Bindings +@property (nonatomic, readonly) NSString *currentPictureURI; +@end + +@interface ADCameraJSO +@end + +@interface ADCameraJSO() +@property (nonatomic, copy) NSString *currentPictureURI; +@end