forked from OSchip/llvm-project
Improve idiomatic-parentheses by checking method family instead of relying on the selector name.
llvm-svn: 186524
This commit is contained in:
parent
3e7db845f7
commit
3965574929
|
@ -11968,7 +11968,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
|
|||
Selector Sel = ME->getSelector();
|
||||
|
||||
// self = [<foo> init...]
|
||||
if (isSelfExpr(Op->getLHS()) && Sel.getNameForSlot(0).startswith("init"))
|
||||
if (isSelfExpr(Op->getLHS()) && ME->getMethodFamily() == OMF_init)
|
||||
diagnostic = diag::warn_condition_is_idiomatic_assignment;
|
||||
|
||||
// <foo> = [<bar> nextObject]
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
}
|
||||
- (id) init;
|
||||
- (id) initWithInt: (int) i;
|
||||
- (id) myInit __attribute__((objc_method_family(init)));
|
||||
- (void) iterate: (id) coll;
|
||||
- (id) nextObject;
|
||||
@property unsigned uid;
|
||||
|
@ -34,6 +35,12 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) myInit {
|
||||
if (self = [self myInit]) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) iterate: (id) coll {
|
||||
id cur;
|
||||
while (cur = [coll nextObject]) {
|
||||
|
|
Loading…
Reference in New Issue