From 369a9c3b515b5b80fd27e2a19506f6fdaa2b984e Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 27 Jan 2014 19:14:49 +0000 Subject: [PATCH] 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 llvm-svn: 200238 --- clang/lib/Sema/SemaObjCProperty.cpp | 12 ++++++++++++ clang/test/SemaObjC/continuation-class-property.m | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index beb58ecdfa39..c8358bccb6f7 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/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/clang/test/SemaObjC/continuation-class-property.m b/clang/test/SemaObjC/continuation-class-property.m index 2a8e5085fe7f..83aa796309f5 100644 --- a/clang/test/SemaObjC/continuation-class-property.m +++ b/clang/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