Objective-C migrator: when inferring 'readonly' property of an

Objective-C object conforming to 'NSCopying' protocol, infer
a 'copy' property, instead of 'strong'. // rdar://15525937

llvm-svn: 197102
This commit is contained in:
Fariborz Jahanian 2013-12-12 01:02:00 +00:00
parent e6a8775183
commit 49e69ee557
4 changed files with 6 additions and 4 deletions

View File

@ -324,7 +324,9 @@ void MigrateBlockOrFunctionPointerTypeVariable(std::string & PropertyString,
static const char *PropertyMemoryAttribute(ASTContext &Context, QualType ArgType) {
Qualifiers::ObjCLifetime propertyLifetime = ArgType.getObjCLifetime();
bool RetainableObject = ArgType->isObjCRetainableType();
if (RetainableObject && propertyLifetime == Qualifiers::OCL_Strong) {
if (RetainableObject &&
(propertyLifetime == Qualifiers::OCL_Strong
|| propertyLifetime == Qualifiers::OCL_None)) {
if (const ObjCObjectPointerType *ObjPtrTy =
ArgType->getAs<ObjCObjectPointerType>()) {
ObjCInterfaceDecl *IDecl = ObjPtrTy->getObjectType()->getInterface();

View File

@ -87,7 +87,7 @@ typedef char BOOL;
@property (getter=getStringValue, strong) NSString *stringValue;
@property (getter=getCounterValue, readonly) BOOL counterValue;
@property (getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
@property (getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out

View File

@ -94,7 +94,7 @@ typedef char BOOL;
@property (NS_NONATOMIC_IOSONLY, getter=getStringValue, strong) NSString *stringValue;
@property (NS_NONATOMIC_IOSONLY, getter=getCounterValue, readonly) BOOL counterValue;
@property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
@property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out

View File

@ -90,7 +90,7 @@ typedef char BOOL;
@property (nonatomic, getter=getStringValue, strong) NSString *stringValue;
@property (nonatomic, getter=getCounterValue, readonly) BOOL counterValue;
@property (nonatomic, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
@property (nonatomic, getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out