(nonfragile-abi2), do not consider 'ivar' access
in class methods. Also, improve on diagnostics.
Radar
8304561.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111023
91177308-0d34-0410-b5e6-
96231b3b80d8
"place parentheses around the assignment to silence this warning">;
def warn_ivar_variable_conflict : Warning<
- "%0 lookup will access the property ivar in nonfragile-abi2 mode">,
+ "when default property synthesis is on, "
+ "%0 lookup will access property ivar instead of global variable">,
InGroup<NonfragileAbi2>;
+def note_global_declared_at : Note<"global variable declared here">;
// assignment related diagnostics (also for argument passing, returning, etc).
// In most of these diagnostics the %2 is a value from the
return ActOnIdExpression(S, SS, Id, HasTrailingLParen,
isAddressOfOperand);
}
+ // for further use, this must be set to false if in class method.
+ IvarLookupFollowUp = getCurMethodDecl()->isInstanceMethod();
}
}
if (Property) {
Diag(NameLoc, diag::warn_ivar_variable_conflict) << Var->getDeclName();
Diag(Property->getLocation(), diag::note_property_declare);
+ Diag(Var->getLocation(), diag::note_global_declared_at);
}
}
} else if (FunctionDecl *Func = R.getAsSingle<FunctionDecl>()) {
// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
// rdar : // 8225011
-int glob;
+int glob; // expected-note {{global variable declared here}}
@interface I
@property int glob; // expected-note {{property declared here}}
@end
@implementation I
-- (int) Meth { return glob; } // expected-warning {{'glob' lookup will access the property ivar in nonfragile-abi2 mode}}
+- (int) Meth { return glob; } // expected-warning {{when default property synthesis is on, 'glob' lookup will access}}
@synthesize glob;
// rdar: // 8248681
- (int) Meth1: (int) p {