Skip to content
Snippets Groups Projects
Commit 2bddd43b authored by Argyrios Kyrtzidis's avatar Argyrios Kyrtzidis
Browse files

[objcmt] Don't add redundant parentheses when migrating subscripting of an ivar.

rdar://11501256

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157227 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3a465303
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment