r192841 - ObjectiveC migrator. Don't add 'assign' for
Fariborz Jahanian
fjahanian at apple.com
Wed Oct 16 13:44:27 PDT 2013
Author: fjahanian
Date: Wed Oct 16 15:44:26 2013
New Revision: 192841
URL: http://llvm.org/viewvc/llvm-project?rev=192841&view=rev
Log:
ObjectiveC migrator. Don't add 'assign' for
inferred properties when type is scalar and
assumed to be 'assign. // rdar://15231241
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-property.m
cfe/trunk/test/ARCMT/objcmt-property.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=192841&r1=192840&r2=192841&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Oct 16 15:44:26 2013
@@ -311,8 +311,11 @@ static bool rewriteToObjCProperty(const
// "dataSource", or have exact name "target" to have 'assign' attribute.
if (PropertyName.equals("target") ||
(PropertyName.find("delegate") != StringRef::npos) ||
- (PropertyName.find("dataSource") != StringRef::npos))
- append_attr(PropertyString, "assign", LParenAdded);
+ (PropertyName.find("dataSource") != StringRef::npos)) {
+ QualType QT = Getter->getResultType();
+ if (!QT->isRealType())
+ append_attr(PropertyString, "assign", LParenAdded);
+ }
else if (Setter) {
const ParmVarDecl *argDecl = *Setter->param_begin();
QualType ArgType = Context.getCanonicalType(argDecl->getType());
Modified: cfe/trunk/test/ARCMT/objcmt-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m?rev=192841&r1=192840&r2=192841&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m Wed Oct 16 15:44:26 2013
@@ -227,3 +227,11 @@ DEPRECATED
- (id (*)(id, NSArray *, NSMutableDictionary *)) MyFuncptr;
- (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
@end
+
+// rdar://15231241
+ at interface rdar15231241
+ at property (nonatomic, readonly) double Ddelegate;
+ at property (nonatomic, readonly) float Fdelegate;
+ at property (nonatomic, readonly) int Idelegate;
+ at property (nonatomic, readonly) BOOL Bdelegate;
+ at end
Modified: cfe/trunk/test/ARCMT/objcmt-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m.result?rev=192841&r1=192840&r2=192841&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Wed Oct 16 15:44:26 2013
@@ -227,3 +227,11 @@ DEPRECATED
@property (nonatomic) id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *);
@end
+
+// rdar://15231241
+ at interface rdar15231241
+ at property (nonatomic, readonly) double Ddelegate;
+ at property (nonatomic, readonly) float Fdelegate;
+ at property (nonatomic, readonly) int Idelegate;
+ at property (nonatomic, readonly) BOOL Bdelegate;
+ at end
More information about the cfe-commits
mailing list