diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-04-04 20:05:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-04-04 20:05:25 +0000 |
commit | 878f8502ebea491b818b48e342f9ad9de2feaff6 (patch) | |
tree | dfb87bb0605d37e49917228022500101068d9511 /lib/Sema | |
parent | bb811cab1bfa91074f1992b154fcb0c288e6eda3 (diff) |
objc-arc: provide a warning when 'receiver' of a message is 'weak'
in arc mode and opted-in with -Wreceiver-is-weak flag.
// rdar://10225276
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 448f145964..b62d56efda 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -2232,6 +2232,11 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, } if (getLangOpts().ObjCAutoRefCount) { + if (Receiver && + (Receiver->IgnoreParenImpCasts()->getType().getObjCLifetime() + == Qualifiers::OCL_Weak)) + Diag(Receiver->getLocStart(), diag::warn_receiver_is_weak); + // In ARC, annotate delegate init calls. if (Result->getMethodFamily() == OMF_init && (SuperLoc.isValid() || isSelfExpr(Receiver))) { |