r295674 - [Sema][ObjC] perform-selector ARC check should see @selector in parens

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 09:55:16 PST 2017


Author: arphaman
Date: Mon Feb 20 11:55:15 2017
New Revision: 295674

URL: http://llvm.org/viewvc/llvm-project?rev=295674&view=rev
Log:
[Sema][ObjC] perform-selector ARC check should see @selector in parens

Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/arc-peformselector.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=295674&r1=295673&r2=295674&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Feb 20 11:55:15 2017
@@ -2920,7 +2920,8 @@ ExprResult Sema::BuildInstanceMessage(Ex
     
     case OMF_performSelector:
       if (Method && NumArgs >= 1) {
-        if (ObjCSelectorExpr *SelExp = dyn_cast<ObjCSelectorExpr>(Args[0])) {
+        if (const auto *SelExp =
+                dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens())) {
           Selector ArgSel = SelExp->getSelector();
           ObjCMethodDecl *SelMethod = 
             LookupInstanceMethodInGlobalPool(ArgSel,

Modified: cfe/trunk/test/SemaObjC/arc-peformselector.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-peformselector.m?rev=295674&r1=295673&r2=295674&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-peformselector.m (original)
+++ cfe/trunk/test/SemaObjC/arc-peformselector.m Mon Feb 20 11:55:15 2017
@@ -27,6 +27,7 @@
   return [self performSelector : @selector(init)];
   return [self performSelector : sel1]; // expected-warning {{performSelector may cause a leak because its selector is unknown}} \
 					// expected-note {{used here}}
+  return [self performSelector: (@selector(PlusZero))];
 
   return [self performSelector : @selector(PlusZero)];
   return [self performSelector : @selector(PlusOne)]; // expected-error {{performSelector names a selector which retains the object}}




More information about the cfe-commits mailing list