objc-arc: 'readonly' property of retainable object
type is strong by default too. // rdar://10410903
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144118 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 46b2a08..4933f00 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1770,13 +1770,12 @@
ObjCDeclSpec::DQ_PR_unsafe_unretained |
ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong |
ObjCDeclSpec::DQ_PR_weak)) &&
- !(Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
PropertyTy->isObjCObjectPointerType()) {
if (getLangOptions().ObjCAutoRefCount)
// With arc, @property definitions should default to (strong) when
- // not specified
+ // not specified; including when property is 'readonly'.
PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
- else {
+ else if (!(Attributes & ObjCDeclSpec::DQ_PR_readonly)) {
// Skip this warning in gc-only mode.
if (getLangOptions().getGC() != LangOptions::GCOnly)
Diag(Loc, diag::warn_objc_property_no_assignment_attribute);