if (D == 0 || D->isDefinedOutsideFunctionOrMethod()) {
ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface();
if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II)) {
+ // Check if referencing a field with __attribute__((deprecated)).
+ DiagnoseUseOfDeprecatedDecl(IV, Loc);
+
// FIXME: This should use a new expr for a direct reference, don't turn
// this into Self->ivar, just return a BareIVarExpr or something.
IdentifierInfo &II = Context.Idents.get("self");
DiagnoseUseOfDeprecatedDecl(VD, Loc);
if (VarDecl *Var = dyn_cast<VarDecl>(VD)) {
+ // Warn about constructs like:
+ // if (void *X = foo()) { ... } else { X }.
+ // In the else block, the pointer is always false.
if (Var->isDeclaredInCondition() && Var->getType()->isScalarType()) {
Scope *CheckS = S;
while (CheckS) {
if (IV->isInvalidDecl())
return ExprError();
+ // Check if referencing a field with __attribute__((deprecated)).
+ DiagnoseUseOfDeprecatedDecl(IV, MemberLoc);
+
ObjCIvarRefExpr *MRef= new (Context) ObjCIvarRefExpr(IV, IV->getType(),
MemberLoc, BaseExpr,
OpKind == tok::arrow);
// RUN: clang %s -fsyntax-only -verify
-@interface A
+@interface A {
+ int X __attribute__((deprecated));
+}
+ (void)F __attribute__((deprecated));
- (void)f __attribute__((deprecated));
@end
- (void)g
{
+ X++; // expected-warning{{'X' is deprecated}}
+ self->X++; // expected-warning{{'X' is deprecated}}
[self f]; // expected-warning{{'f' is deprecated}}
}