diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2015-03-10 21:28:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2015-03-10 21:28:33 +0000 |
commit | 2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e (patch) | |
tree | f4afb1872cd3c64247f2e87b02214f56ea546743 /clang/lib/Sema/SemaExprObjC.cpp | |
parent | bdc6c83d24b10d350f6ce1cb408c9b1064e60508 (diff) | |
download | bcm5719-llvm-2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e.tar.gz bcm5719-llvm-2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e.zip |
[Objective-C Sema]. Remove -Wreceiver-is-weak warning.
It is incorrect and better warning is issued under
-Warc-repeated-use-of-weak. rdar://16316934.
llvm-svn: 231851
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 1fa94e9d2ce..f5e6806c0e0 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -1509,64 +1509,6 @@ ObjCMethodDecl *Sema::LookupMethodInQualifiedType(Selector Sel, return nullptr; } -static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) { - if (!Receiver) - return; - - if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(Receiver)) - Receiver = OVE->getSourceExpr(); - - Expr *RExpr = Receiver->IgnoreParenImpCasts(); - SourceLocation Loc = RExpr->getLocStart(); - QualType T = RExpr->getType(); - const ObjCPropertyDecl *PDecl = nullptr; - const ObjCMethodDecl *GDecl = nullptr; - if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(RExpr)) { - RExpr = POE->getSyntacticForm(); - if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(RExpr)) { - if (PRE->isImplicitProperty()) { - GDecl = PRE->getImplicitPropertyGetter(); - if (GDecl) { - T = GDecl->getReturnType(); - } - } - else { - PDecl = PRE->getExplicitProperty(); - if (PDecl) { - T = PDecl->getType(); - } - } - } - } - else if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(RExpr)) { - // See if receiver is a method which envokes a synthesized getter - // backing a 'weak' property. - ObjCMethodDecl *Method = ME->getMethodDecl(); - if (Method && Method->getSelector().getNumArgs() == 0) { - PDecl = Method->findPropertyDecl(); - if (PDecl) - T = PDecl->getType(); - } - } - - if (T.getObjCLifetime() != Qualifiers::OCL_Weak) { - if (!PDecl) - return; - if (!(PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_weak)) - return; - } - - S.Diag(Loc, diag::warn_receiver_is_weak) - << ((!PDecl && !GDecl) ? 0 : (PDecl ? 1 : 2)); - - if (PDecl) - S.Diag(PDecl->getLocation(), diag::note_property_declare); - else if (GDecl) - S.Diag(GDecl->getLocation(), diag::note_method_declared_at) << GDecl; - - S.Diag(Loc, diag::note_arc_assign_to_strong); -} - /// HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an /// objective C interface. This is a property reference expression. ExprResult Sema:: @@ -2760,15 +2702,6 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, } if (getLangOpts().ObjCAutoRefCount) { - // Do not warn about IBOutlet weak property receivers being set to null - // as this cannot asynchronously happen. - bool WarnWeakReceiver = true; - if (isImplicit && Method) - if (const ObjCPropertyDecl *PropertyDecl = Method->findPropertyDecl()) - WarnWeakReceiver = !PropertyDecl->hasAttr<IBOutletAttr>(); - if (WarnWeakReceiver) - DiagnoseARCUseOfWeakReceiver(*this, Receiver); - // In ARC, annotate delegate init calls. if (Result->getMethodFamily() == OMF_init && (SuperLoc.isValid() || isSelfExpr(Receiver))) { |