forked from OSchip/llvm-project
[objcmt] Don't add redundant parentheses when migrating subscripting of an ivar.
rdar://11501256 llvm-svn: 157227
This commit is contained in:
parent
058bb9908f
commit
94442980c0
|
@ -624,6 +624,7 @@ static bool subscriptOperatorNeedsParens(const Expr *FullExpr) {
|
|||
isa<ObjCPropertyRefExpr>(Expr) ||
|
||||
isa<ObjCProtocolExpr>(Expr) ||
|
||||
isa<MemberExpr>(Expr) ||
|
||||
isa<ObjCIvarRefExpr>(Expr) ||
|
||||
isa<ParenExpr>(FullExpr) ||
|
||||
isa<ParenListExpr>(Expr) ||
|
||||
isa<SizeOfPackExpr>(Expr))
|
||||
|
@ -650,6 +651,7 @@ static bool castOperatorNeedsParens(const Expr *FullExpr) {
|
|||
isa<ObjCPropertyRefExpr>(Expr) ||
|
||||
isa<ObjCProtocolExpr>(Expr) ||
|
||||
isa<MemberExpr>(Expr) ||
|
||||
isa<ObjCIvarRefExpr>(Expr) ||
|
||||
isa<ParenExpr>(FullExpr) ||
|
||||
isa<ParenListExpr>(Expr) ||
|
||||
isa<SizeOfPackExpr>(Expr) ||
|
||||
|
|
|
@ -77,7 +77,9 @@ typedef const struct __CFString * CFStringRef;
|
|||
#define PAIR(x) @#x, [NSNumber numberWithInt:(x)]
|
||||
#define TWO(x) ((x), (x))
|
||||
|
||||
@interface I
|
||||
@interface I {
|
||||
NSArray *ivarArr;
|
||||
}
|
||||
@end
|
||||
@implementation I
|
||||
-(void) foo {
|
||||
|
@ -138,6 +140,7 @@ typedef const struct __CFString * CFStringRef;
|
|||
o = [*parr objectAtIndex:2];
|
||||
void *hd;
|
||||
o = [(NSArray*)hd objectAtIndex:2];
|
||||
o = [ivarArr objectAtIndex:2];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@ typedef const struct __CFString * CFStringRef;
|
|||
#define PAIR(x) @#x, [NSNumber numberWithInt:(x)]
|
||||
#define TWO(x) ((x), (x))
|
||||
|
||||
@interface I
|
||||
@interface I {
|
||||
NSArray *ivarArr;
|
||||
}
|
||||
@end
|
||||
@implementation I
|
||||
-(void) foo {
|
||||
|
@ -138,6 +140,7 @@ typedef const struct __CFString * CFStringRef;
|
|||
o = (*parr)[2];
|
||||
void *hd;
|
||||
o = ((NSArray*)hd)[2];
|
||||
o = ivarArr[2];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue