forked from OSchip/llvm-project
When issuing warning for future conflict resolution,
(nonfragile-abi2), do not consider 'ivar' access in class methods. Also, improve on diagnostics. Radar 8304561. llvm-svn: 111023
This commit is contained in:
parent
081861b6b7
commit
18d90a97df
|
@ -2520,8 +2520,10 @@ def note_condition_assign_silence : Note<
|
|||
"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
|
||||
|
|
|
@ -1142,6 +1142,8 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
|
|||
return ActOnIdExpression(S, SS, Id, HasTrailingLParen,
|
||||
isAddressOfOperand);
|
||||
}
|
||||
// for further use, this must be set to false if in class method.
|
||||
IvarLookupFollowUp = getCurMethodDecl()->isInstanceMethod();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1193,6 +1195,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
|
|||
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>()) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// 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}}
|
||||
|
@ -13,7 +13,7 @@ int glob;
|
|||
@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 {
|
||||
|
|
Loading…
Reference in New Issue