r190539 - ObjectiveC migrator. Modify inferred property name
Fariborz Jahanian
fjahanian at apple.com
Wed Sep 11 11:27:17 PDT 2013
Author: fjahanian
Date: Wed Sep 11 13:27:16 2013
New Revision: 190539
URL: http://llvm.org/viewvc/llvm-project?rev=190539&view=rev
Log:
ObjectiveC migrator. Modify inferred property name
such that it does not lower case the staring property
name if getter name (after "get" prefix) starts with
two upper case letters.
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=190539&r1=190538&r2=190539&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Sep 11 13:27:16 2013
@@ -312,7 +312,11 @@ static bool rewriteToObjCProperty(const
PropertyNameStringRef = PropertyNameStringRef.drop_front(LengthOfPrefix);
PropertyNameString = PropertyNameStringRef;
std::string NewPropertyNameString = PropertyNameString;
- NewPropertyNameString[0] = toLowercase(NewPropertyNameString[0]);
+ bool NoLowering = (isUppercase(NewPropertyNameString[0]) &&
+ NewPropertyNameString.size() > 1 &&
+ isUppercase(NewPropertyNameString[1]));
+ if (!NoLowering)
+ NewPropertyNameString[0] = toLowercase(NewPropertyNameString[0]);
PropertyString += NewPropertyNameString;
}
else
Modified: cfe/trunk/test/ARCMT/objcmt-property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m?rev=190539&r1=190538&r2=190539&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m Wed Sep 11 13:27:16 2013
@@ -106,6 +106,12 @@ typedef char BOOL;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out
+
+- (BOOL) getM;
+- (BOOL) getMA;
+- (BOOL) getALL;
+- (BOOL) getMANY;
+- (BOOL) getSome;
@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=190539&r1=190538&r2=190539&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Wed Sep 11 13:27:16 2013
@@ -106,6 +106,12 @@ typedef char BOOL;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out
+
+ at property(nonatomic, getter=getM, readonly) BOOL m;
+ at property(nonatomic, getter=getMA, readonly) BOOL MA;
+ at property(nonatomic, getter=getALL, readonly) BOOL ALL;
+ at property(nonatomic, getter=getMANY, readonly) BOOL MANY;
+ at property(nonatomic, getter=getSome, readonly) BOOL some;
@end
More information about the cfe-commits
mailing list