Add a method prototype slot/getter to the ObjCMessageExpr AST.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43666 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 30aa7b3..bc371c7 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -2074,8 +2074,8 @@
         return true;
     }
   }
-  return new ObjCMessageExpr(receiverName, Sel, returnType, lbrac, rbrac,
-                             ArgExprs);
+  return new ObjCMessageExpr(receiverName, Sel, returnType, Method,
+                             lbrac, rbrac, ArgExprs);
 }
 
 // ActOnInstanceMessage - used for both unary and keyword messages.
@@ -2091,9 +2091,10 @@
   Expr *RExpr = static_cast<Expr *>(receiver);
   QualType receiverType = RExpr->getType();
   QualType returnType;
+  ObjcMethodDecl *Method;
   
   if (receiverType == Context.getObjcIdType()) {
-    ObjcMethodDecl *Method = InstanceMethodPool[Sel].Method;
+    Method = InstanceMethodPool[Sel].Method;
     if (!Method) {
       Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(),
            SourceRange(lbrac, rbrac));
@@ -2119,7 +2120,7 @@
     // FIXME: consider using InstanceMethodPool, since it will be faster
     // than the following method (which can do *many* linear searches). The
     // idea is to add class info to InstanceMethodPool...
-    ObjcMethodDecl *Method = ClassDecl->lookupInstanceMethod(Sel);
+    Method = ClassDecl->lookupInstanceMethod(Sel);
     if (!Method) {
       Diag(lbrac, diag::warn_method_not_found, std::string("-"), Sel.getName(),
            SourceRange(lbrac, rbrac));
@@ -2131,5 +2132,6 @@
           return true;
     }
   }
-  return new ObjCMessageExpr(RExpr, Sel, returnType, lbrac, rbrac, ArgExprs);
+  return new ObjCMessageExpr(RExpr, Sel, returnType, Method, lbrac, rbrac, 
+                             ArgExprs);
 }