]> granicus.if.org Git - clang/commitdiff
ObjectiveC. When introducing a new property declaration in
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 27 Jan 2014 19:14:49 +0000 (19:14 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 27 Jan 2014 19:14:49 +0000 (19:14 +0000)
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

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/continuation-class-property.m

index beb58ecdfa39aaccd00f1df828f27e79fe75bf33..c8358bccb6f76a4b281e033f97698c35018e1dbf 100644 (file)
@@ -463,6 +463,18 @@ Sema::HandlePropertyInClassExtension(Scope *S,
     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
index 2a8e5085fe7ffd66a1f68752c42339a02f073899..83aa796309f52e318703fd63c99d2fca7633e4fc 100644 (file)
@@ -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()  <ADCameraJSO_Bindings>
+@property (nonatomic, copy) NSString *currentPictureURI;
+@end