ObjC migration: Skip over setter/getter with attributes
for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp
index d01dca4..5cb2223 100644
--- a/lib/ARCMigrate/ObjCMT.cpp
+++ b/lib/ARCMigrate/ObjCMT.cpp
@@ -199,6 +199,10 @@
QualType GRT = Method->getResultType();
if (GRT->isVoidType())
continue;
+ // FIXME. Don't know what todo with attributes, skip for now.
+ if (Method->hasAttrs())
+ continue;
+
Selector GetterSelector = Method->getSelector();
IdentifierInfo *getterName = GetterSelector.getIdentifierInfoForSlot(0);
Selector SetterSelector =
@@ -212,7 +216,8 @@
continue;
const ParmVarDecl *argDecl = *SetterMethod->param_begin();
QualType ArgType = argDecl->getType();
- if (!Ctx.hasSameUnqualifiedType(ArgType, GRT))
+ if (!Ctx.hasSameUnqualifiedType(ArgType, GRT) ||
+ SetterMethod->hasAttrs())
continue;
edit::Commit commit(*Editor);
edit::rewriteToObjCProperty(Method, SetterMethod, *NSAPIObj, commit);
diff --git a/test/ARCMT/objcmt-property.m b/test/ARCMT/objcmt-property.m
index f2d5e1a..d13a491 100644
--- a/test/ARCMT/objcmt-property.m
+++ b/test/ARCMT/objcmt-property.m
@@ -14,6 +14,16 @@
- (NSString *) StrongProp;
- (void) setStrongProp : (NSString *)Val;
+
+- (NSString *) UnavailProp __attribute__((unavailable));
+- (void) setUnavailProp : (NSString *)Val;
+
+- (NSString *) UnavailProp1 __attribute__((unavailable));
+- (void) setUnavailProp1 : (NSString *)Val __attribute__((unavailable));
+
+- (NSString *) UnavailProp2;
+- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
+
@end
@implementation I
diff --git a/test/ARCMT/objcmt-property.m.result b/test/ARCMT/objcmt-property.m.result
index 87b71e1..771d863 100644
--- a/test/ARCMT/objcmt-property.m.result
+++ b/test/ARCMT/objcmt-property.m.result
@@ -14,6 +14,16 @@
@property(strong) NSString * StrongProp;
+
+- (NSString *) UnavailProp __attribute__((unavailable));
+- (void) setUnavailProp : (NSString *)Val;
+
+- (NSString *) UnavailProp1 __attribute__((unavailable));
+- (void) setUnavailProp1 : (NSString *)Val __attribute__((unavailable));
+
+- (NSString *) UnavailProp2;
+- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
+
@end
@implementation I