BodyMigrator(*this).TraverseDecl(D);
}
-static void append_attr(std::string &PropertyString, const char *attr,
- bool GetterHasIsPrefix) {
- PropertyString += (GetterHasIsPrefix ? ", " : "(");
+static void append_attr(std::string &PropertyString, const char *attr) {
+ PropertyString += ", ";
PropertyString += attr;
- PropertyString += ')';
}
static bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
const NSAPI &NS, edit::Commit &commit,
bool GetterHasIsPrefix) {
ASTContext &Context = NS.getASTContext();
- std::string PropertyString = "@property";
+ std::string PropertyString = "@property(nonatomic";
std::string PropertyNameString = Getter->getNameAsString();
StringRef PropertyName(PropertyNameString);
if (GetterHasIsPrefix) {
- PropertyString += "(getter=";
+ PropertyString += ", getter=";
PropertyString += PropertyNameString;
}
// Short circuit properties that contain the name "delegate" or "dataSource",
if (PropertyName.equals("target") ||
(PropertyName.find("delegate") != StringRef::npos) ||
(PropertyName.find("dataSource") != StringRef::npos))
- append_attr(PropertyString, "unsafe_unretained", GetterHasIsPrefix);
+ append_attr(PropertyString, "unsafe_unretained");
else {
const ParmVarDecl *argDecl = *Setter->param_begin();
QualType ArgType = Context.getCanonicalType(argDecl->getType());
ObjCInterfaceDecl *IDecl = ObjPtrTy->getObjectType()->getInterface();
if (IDecl &&
IDecl->lookupNestedProtocol(&Context.Idents.get("NSCopying")))
- append_attr(PropertyString, "copy", GetterHasIsPrefix);
+ append_attr(PropertyString, "copy");
else
- append_attr(PropertyString, "retain", GetterHasIsPrefix);
- } else if (GetterHasIsPrefix)
- PropertyString += ')';
+ append_attr(PropertyString, "retain");
+ }
} else if (propertyLifetime == Qualifiers::OCL_Weak)
// TODO. More precise determination of 'weak' attribute requires
// looking into setter's implementation for backing weak ivar.
- append_attr(PropertyString, "weak", GetterHasIsPrefix);
+ append_attr(PropertyString, "weak");
else if (RetainableObject)
- append_attr(PropertyString, "retain", GetterHasIsPrefix);
- else if (GetterHasIsPrefix)
- PropertyString += ')';
+ append_attr(PropertyString, "retain");
}
+ PropertyString += ')';
QualType RT = Getter->getResultType();
if (!isa<TypedefType>(RT)) {
int ivarVal;
}
-@property(weak) NSString * WeakProp;
+@property(nonatomic, weak) NSString * WeakProp;
-@property(retain) NSString * StrongProp;
+@property(nonatomic, retain) NSString * StrongProp;
- (NSString *) UnavailProp __attribute__((unavailable));
- (NSString *) UnavailProp2;
- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
-@property(copy) NSDictionary * undoAction;
+@property(nonatomic, copy) NSDictionary * undoAction;
@end
-@property(retain) NSArray * names2;
-@property(retain) NSArray * names3;
-@property(retain) NSArray * names4;
-@property(retain) NSArray * names1;
+@property(nonatomic, retain) NSArray * names2;
+@property(nonatomic, retain) NSArray * names3;
+@property(nonatomic, retain) NSArray * names4;
+@property(nonatomic, retain) NSArray * names1;
@end
// Properties that contain the name "delegate" or "dataSource",
// or have exact name "target" have unsafe_unretained attribute.
@interface NSInvocation
-@property(unsafe_unretained) id target;
+@property(nonatomic, unsafe_unretained) id target;
-@property(unsafe_unretained) id dataSource;
+@property(nonatomic, unsafe_unretained) id dataSource;
-@property(unsafe_unretained) id xxxdelegateYYY;
+@property(nonatomic, unsafe_unretained) id xxxdelegateYYY;
-@property(retain) id MYtarget;
+@property(nonatomic, retain) id MYtarget;
-@property(retain) id targetX;
+@property(nonatomic, retain) id targetX;
-@property int value;
+@property(nonatomic) int value;
-@property(getter=isContinuous) BOOL continuous;
+@property(nonatomic, getter=isContinuous) BOOL continuous;
- (id) isAnObject;