]> granicus.if.org Git - clang/commitdiff
ObjectiveC migrator. Modify inferred property name
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 11 Sep 2013 18:27:16 +0000 (18:27 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 11 Sep 2013 18:27:16 +0000 (18:27 +0000)
such that it does not lower case the staring property
name if getter name (after "get" prefix) starts with
two upper case letters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190539 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/ObjCMT.cpp
test/ARCMT/objcmt-property.m
test/ARCMT/objcmt-property.m.result

index f550e7cad0393f04c97c799137ea760508f25f3a..79336bb9063cb93a57f96aa7f08c947df02ec0b7 100644 (file)
@@ -312,7 +312,11 @@ static bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
     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
index 924679841f12d38df45e2866de89dbc3d1e992ad..60346d7631b3660fbd4373d7a9a696394cb7fd24 100644 (file)
@@ -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
 
 
index f1caec3137bd43304dbae565cc25bb585f077107..7066a50a60a4ff76f077967f941b16a6bc12c1e7 100644 (file)
@@ -106,6 +106,12 @@ typedef char BOOL;
 
 - (BOOL)is3bar; // watch out
 - (NSString *)get3foo; // watch out
+
+@property(nonatomic, getter=getM, readonly) BOOL m;
+@property(nonatomic, getter=getMA, readonly) BOOL MA;
+@property(nonatomic, getter=getALL, readonly) BOOL ALL;
+@property(nonatomic, getter=getMANY, readonly) BOOL MANY;
+@property(nonatomic, getter=getSome, readonly) BOOL some;
 @end