From 5fa065b55bd622f20656e0de3b1f122951146784 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 13 Oct 2011 23:45:45 +0000 Subject: [PATCH] objc-arc: 'Class' property is implicitly __unsafe_unretained. // rdar://10239594 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141915 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaObjCProperty.cpp | 2 +- test/SemaObjC/arc-property-lifetime.m | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 33069928f2..751f553945 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -39,7 +39,7 @@ static Qualifiers::ObjCLifetime getImpliedARCOwnership( if (attrs & (ObjCPropertyDecl::OBJC_PR_retain | ObjCPropertyDecl::OBJC_PR_strong | ObjCPropertyDecl::OBJC_PR_copy)) { - return Qualifiers::OCL_Strong; + return type->getObjCARCImplicitLifetime(); } else if (attrs & ObjCPropertyDecl::OBJC_PR_weak) { return Qualifiers::OCL_Weak; } else if (attrs & ObjCPropertyDecl::OBJC_PR_unsafe_unretained) { diff --git a/test/SemaObjC/arc-property-lifetime.m b/test/SemaObjC/arc-property-lifetime.m index cbed455ddc..9cc3ada15f 100644 --- a/test/SemaObjC/arc-property-lifetime.m +++ b/test/SemaObjC/arc-property-lifetime.m @@ -110,3 +110,18 @@ @synthesize isAutosaving = _isAutosaving; @end +// rdar://10239594 +// Test for 'Class' properties being unretained. +@interface MyClass { +@private + Class _controllerClass; + id _controllerId; +} +@property (copy) Class controllerClass; +@property (copy) id controllerId; +@end + +@implementation MyClass +@synthesize controllerClass = _controllerClass; +@synthesize controllerId = _controllerId; +@end -- 2.40.0