diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-27 21:19:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-27 21:19:25 +0000 |
commit | 7e35274df4a598d5e3e4b8b5567bcb256fc2ab2f (patch) | |
tree | 9af0d7e5a8732234086cac9ea35c54ee2014f780 /lib/Sema/SemaExpr.cpp | |
parent | e81fdb1fdde48d3fa18df56c5797f6b0bc5dfc4a (diff) |
Objective-C: Issue more precise warning when user
is accessing 'isa' as an object pointer.
// rdar://13503456. FixIt to follow in another patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index c0b1ad1998..54422e81eb 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -491,6 +491,8 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) { } 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 @@ -8535,6 +8537,9 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, 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, |