def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">;
def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">;
def ObjCRootClass : DiagGroup<"objc-root-class">;
+def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
def Packed : DiagGroup<"packed">;
def Padded : DiagGroup<"padded">;
def PointerArith : DiagGroup<"pointer-arith">;
"'assign' is assumed">,
InGroup<ObjCPropertyNoAttribute>;
def warn_objc_isa_use : Warning<
- "direct access to Objective-C's isa is deprecated "
- "in favor of object_setClass() and object_getClass()">,
- InGroup<DiagGroup<"deprecated-objc-isa-usage">>;
+ "direct access to Objective-C's isa is deprecated in favor of "
+ "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
+def warn_objc_isa_assign : Warning<
+ "assignemt to Objective-C's isa is deprecated in favor of "
+ "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
def warn_objc_property_default_assign_on_object : Warning<
"default property attribute 'assign' not appropriate for non-GC object">,
InGroup<ObjCPropertyNoAttribute>;
}
CheckForNullPointerDereference(*this, E);
+ if (isa<ObjCIsaExpr>(E->IgnoreParens()))
+ Diag(E->getExprLoc(), diag::warn_objc_isa_use);
// C++ [conv.lval]p1:
// [...] If T is a non-class type, the type of the prvalue is the
CheckArrayAccess(LHS.get());
CheckArrayAccess(RHS.get());
+ if (isa<ObjCIsaExpr>(LHS.get()->IgnoreParens()))
+ Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign);
+
if (CompResultTy.isNull())
return Owned(new (Context) BinaryOperator(LHS.take(), RHS.take(), Opc,
ResultTy, VK, OK, OpLoc,
// There's an implicit 'isa' ivar on all objects.
// But we only actually find it this way on objects of type 'id',
// apparently.
- if (OTy->isObjCId() && Member->isStr("isa")) {
- Diag(MemberLoc, diag::warn_objc_isa_use);
+ if (OTy->isObjCId() && Member->isStr("isa"))
return Owned(new (Context) ObjCIsaExpr(BaseExpr.take(), IsArrow, MemberLoc,
Context.getObjCClassType()));
- }
-
if (ShouldTryAgainWithRedefinitionType(*this, BaseExpr))
return LookupMemberExpr(R, BaseExpr, IsArrow, OpLoc, SS,
ObjCImpDecl, HasTemplateArgs);
void pr6302(id x, Class y) {
// This previously crashed the analyzer (reported in PR 6302)
- x->isa = y; // expected-warning {{direct access to Objective-C's isa is deprecated in favor of object_setClass() and object_getClass()}}
+ x->isa = y; // expected-warning {{assignemt to Objective-C's isa is deprecated in favor of object_setClass()}}
}
//===----------------------------------------------------------------------===//
id x;
// rdar://8290002
- [(*x).isa self]; // expected-warning {{direct access to Objective-C's isa is deprecated in favor of object_setClass() and object_getClass()}}
- [x->isa self]; // expected-warning {{direct access to Objective-C's isa is deprecated in favor of object_setClass() and object_getClass()}}
+ [(*x).isa self]; // expected-warning {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
+ [x->isa self]; // expected-warning {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
Whatever *y;
get_an_A(N)->ivar = value; // expected-error{{assigning to 'int' from incompatible type 'int *'}}
get_an_A(N).prop = value2; // expected-error{{assigning to 'int' from incompatible type 'double *'}}
T c = get_an_id(N)->isa; // expected-error{{cannot initialize a variable of type 'int' with an lvalue of type 'Class'}} \
- // expected-warning 5 {{direct access to Objective-C's isa is deprecated in favor of object_setClass() and object_getClass()}}
+ // expected-warning 3 {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
}
template void f<6, Class>(int, int); // expected-note{{in instantiation of}}
template<typename T, typename U>
void f3(U ptr) {
T c = ptr->isa; // expected-error{{cannot initialize a variable of type 'int' with an lvalue of type 'Class'}} \
- // expected-warning 2 {{direct access to Objective-C's isa is deprecated in favor of object_setClass() and object_getClass()}}
+ // expected-warning 1 {{direct access to Objective-C's isa is deprecated in favor of object_getClass()}}
}
template void f3<Class>(id); // expected-note{{in instantiation of}}