diff options
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaObjC/arc-property-decl-attrs.m | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index f42daced863..1cb84e44806 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -868,6 +868,13 @@ static bool hasWrittenStorageAttribute(ObjCPropertyDecl *Prop) { return OrigProp->getPropertyAttributesAsWritten() & OwnershipMask; } + // Look through all of the protocols. + for (const auto *Proto : OrigClass->all_referenced_protocols()) { + if (ObjCPropertyDecl *OrigProp = + Proto->FindPropertyDeclaration(Prop->getIdentifier())) + return OrigProp->getPropertyAttributesAsWritten() & OwnershipMask; + } + return false; } diff --git a/clang/test/SemaObjC/arc-property-decl-attrs.m b/clang/test/SemaObjC/arc-property-decl-attrs.m index 408b2709203..6c96ba481c4 100644 --- a/clang/test/SemaObjC/arc-property-decl-attrs.m +++ b/clang/test/SemaObjC/arc-property-decl-attrs.m @@ -105,3 +105,19 @@ @property(nonatomic, weak, nonnull, readonly) id ROdelegate; // expected-error {{property attributes 'nonnull' and 'weak' are mutually exclusive}} @end +// rdar://problem/23931441 +@protocol P +@property(readonly, retain) id prop; +@end + +__attribute__((objc_root_class)) +@interface I2<P> +@end + +@interface I2() +@property (readwrite) id prop; +@end + +@implementation I2 +@synthesize prop; +@end |