Objective-C moderinzer [qoi], add space on rhs when needed when

converting to property-dot syntax for setters.
rdar://19381786

llvm-svn: 226944
This commit is contained in:
Fariborz Jahanian 2015-01-23 21:58:46 +00:00
parent e368a62676
commit f9317f1586
3 changed files with 46 additions and 0 deletions

View File

@ -309,6 +309,10 @@ namespace {
BegLoc = PP.getLocForEndOfToken(BegLoc);
SourceLocation EndLoc = RHS->getLocStart();
EndLoc = EndLoc.getLocWithOffset(-1);
const char *colon = PP.getSourceManager().getCharacterData(EndLoc);
// Add a space after '=' if there is no space between RHS and '='
if (colon && colon[0] == ':')
PropertyDotString += " ";
SourceRange Range(BegLoc, EndLoc);
commit.replace(Range, PropertyDotString);
// remove '[' ']'

View File

@ -90,3 +90,24 @@ id testRdar19038838(Rdar19038838 *obj) {
}
@end
// rdar://19140114
int NSOnState;
int ArrNSOnState[4];
@interface rdar19140114 : NSObject
{
rdar19140114* menuItem;
}
@property int state;
@end
@implementation rdar19140114
- (void) Meth {
[menuItem setState:NSOnState];
[menuItem setState :NSOnState];
[menuItem setState :ArrNSOnState[NSOnState]];
[menuItem setState : NSOnState];
[menuItem setState: NSOnState];
[menuItem setState: NSOnState];
[menuItem setState : NSOnState];
}
@end

View File

@ -90,3 +90,24 @@ id testRdar19038838(Rdar19038838 *obj) {
}
@end
// rdar://19140114
int NSOnState;
int ArrNSOnState[4];
@interface rdar19140114 : NSObject
{
rdar19140114* menuItem;
}
@property int state;
@end
@implementation rdar19140114
- (void) Meth {
menuItem.state = NSOnState;
menuItem.state = NSOnState;
menuItem.state = ArrNSOnState[NSOnState];
menuItem.state = NSOnState;
menuItem.state = NSOnState;
menuItem.state = NSOnState;
menuItem.state = NSOnState;
}
@end