Objective-C. This patch is to resolve the method used in method
expression to the best method found in global method pools. 
This is wip.  // rdar://16808765

llvm-svn: 215577
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 3e7b620..6cc1658 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -2418,6 +2418,13 @@
         Method = LookupFactoryMethodInGlobalPool(Sel, 
                                                  SourceRange(LBracLoc,RBracLoc),
                                                  receiverIsId);
+      if (Method) {
+        SmallVector<ObjCMethodDecl*, 4> Methods;
+        if (CollectMultipleMethodsInGlobalPool(Sel, Methods,
+                                               Method->isInstanceMethod()))
+          if (ObjCMethodDecl *BestMethod = SelectBestMethod(Sel, ArgsIn, Methods))
+            Method = BestMethod;
+      }
     } else if (ReceiverType->isObjCClassType() ||
                ReceiverType->isObjCQualifiedClassType()) {
       // Handle messages to Class.