Objective-C. Handle case of multiple class methods
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 13 Aug 2014 23:38:04 +0000 (23:38 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 13 Aug 2014 23:38:04 +0000 (23:38 +0000)
found in global pool as well. rdar://16808765

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215603 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprObjC.cpp
test/SemaObjC/resolve-method-in-global-pool.m

index 80ce9baee7526c6dc60ef28906f5872ce53f1466..0facca03915b7d05fe03607477fd114347a2c0ce 100644 (file)
@@ -2420,7 +2420,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
                                                  receiverIsId);
       if (Method)
         if (ObjCMethodDecl *BestMethod =
-                SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))
+              SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))
           Method = BestMethod;
     } else if (ReceiverType->isObjCClassType() ||
                ReceiverType->isObjCQualifiedClassType()) {
@@ -2473,6 +2473,10 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
                       << Sel << SourceRange(LBracLoc, RBracLoc);
                   }
             }
+            if (Method)
+              if (ObjCMethodDecl *BestMethod =
+                  SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))
+                Method = BestMethod;
           }
         }
       }
index 38a2bb7ca5b22f74c29cc0ce913b9d6aeddc9dce..2c5dde4cba9ac121e8c2368b05b652225f2850b2 100644 (file)
@@ -4,7 +4,9 @@
 
 // rdar://16808765
 
-@interface NSObject @end
+@interface NSObject 
++ (void)clsMethod:(int*)arg;
+@end
 
 @class NSDictionary;
 @class NSError;
@@ -18,6 +20,7 @@
 @required
 - (void)getDonuts:(void (^)(NSDictionary *))replyBlock;
 - (void)getCake:(float*)arg, ...;
++ (void)clsMethod:(float*)arg;
 @end
 
 @implementation Foo
@@ -33,3 +36,7 @@
     [(id)0 getCake: &g, 1,3.14];
 }
 @end
+
+void func( Class c, float g ) {
+    [c clsMethod: &g];
+}