summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Sema/Sema.h2
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp11
-rw-r--r--clang/lib/Sema/SemaOverload.cpp6
3 files changed, 10 insertions, 9 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index db8ba03d515..25645ea6fc5 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2894,7 +2894,7 @@ private:
/// \brief - Returns a selector which best matches given argument list or
/// nullptr if none could be found
ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
- SmallVectorImpl<ObjCMethodDecl*>& Methods);
+ bool IsInstance);
/// \brief Record the typo correction failure and return an empty correction.
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 6cc1658934d..80ce9baee75 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -2418,13 +2418,10 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
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;
- }
+ if (Method)
+ if (ObjCMethodDecl *BestMethod =
+ SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))
+ Method = BestMethod;
} else if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType()) {
// Handle messages to Class.
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 660d60da2a3..09469cea772 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -5678,7 +5678,11 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
}
ObjCMethodDecl *Sema::SelectBestMethod(Selector Sel, MultiExprArg Args,
- SmallVectorImpl<ObjCMethodDecl*>& Methods) {
+ bool IsInstance) {
+ SmallVector<ObjCMethodDecl*, 4> Methods;
+ if (!CollectMultipleMethodsInGlobalPool(Sel, Methods, IsInstance))
+ return nullptr;
+
for (unsigned b = 0, e = Methods.size(); b < e; b++) {
bool Match = true;
ObjCMethodDecl *Method = Methods[b];
OpenPOWER on IntegriCloud