aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-24 20:10:53 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-24 20:10:53 +0000
commita6e28f27c668775e3927b9c0be0a17636fed16fc (patch)
treefaf4f88ef5306938d32c08b090b6a47202669f23
parent3d578130c438585476d31f0e8c0bf3223992d683 (diff)
objective-C: When checking for valid overriden property
in class extension, assume default is rewdwrite and don't issue any diagnostics, privided other ownership models are ok. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162583 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaObjCProperty.cpp8
-rw-r--r--test/SemaObjC/overriding-property-in-class-extension.m26
2 files changed, 33 insertions, 1 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 98c1bb27f9..28b4dfa0cc 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -661,7 +661,13 @@ DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
// property.
if (Attributes & ObjCDeclSpec::DQ_PR_readonly) {
if (!classExtPropertyAttr ||
- (classExtPropertyAttr & ObjCDeclSpec::DQ_PR_readwrite))
+ (classExtPropertyAttr &
+ (ObjCDeclSpec::DQ_PR_readwrite|
+ ObjCDeclSpec::DQ_PR_assign |
+ ObjCDeclSpec::DQ_PR_unsafe_unretained |
+ ObjCDeclSpec::DQ_PR_copy |
+ ObjCDeclSpec::DQ_PR_retain |
+ ObjCDeclSpec::DQ_PR_strong)))
continue;
warn = true;
break;
diff --git a/test/SemaObjC/overriding-property-in-class-extension.m b/test/SemaObjC/overriding-property-in-class-extension.m
new file mode 100644
index 0000000000..5cbc6d2ceb
--- /dev/null
+++ b/test/SemaObjC/overriding-property-in-class-extension.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Weverything %s
+// rdar://12103434
+
+@class NSString;
+
+@interface NSObject @end
+
+@interface MyClass : NSObject
+
+@property (nonatomic, copy, readonly) NSString* name;
+
+@end
+
+@interface MyClass () {
+ NSString* _name;
+}
+
+@property (nonatomic, copy) NSString* name;
+
+@end
+
+@implementation MyClass
+
+@synthesize name = _name;
+
+@end