NFC: simplify code in BuildInstanceMessage.
authorManman Ren <manman.ren@gmail.com>
Thu, 7 Apr 2016 19:30:20 +0000 (19:30 +0000)
committerManman Ren <manman.ren@gmail.com>
Thu, 7 Apr 2016 19:30:20 +0000 (19:30 +0000)
commitd2a3cd72615031ac11664f2bd7c280df16a9a97d
tree4ef51c081eb6a238ba0d900f0de18d71cd1daa1c
parentf8baa6605674e1a1ff3fd60b750e42291a4442c5
NFC: simplify code in BuildInstanceMessage.

Instead of searching the global pool multiple times: in
LookupFactoryMethodInGlobalPool, LookupInstanceMethodInGlobalPool,
CollectMultipleMethodsInGlobalPool, and AreMultipleMethodsInGlobalPool,
we now collect the method candidates in CollectMultipleMethodsInGlobalPool
only, and other functions will use the collected method set.

This commit adds parameter "Methods" to AreMultipleMethodsInGlobalPool,
and SelectBestMethod. It also changes the implementation of
CollectMultipleMethodsInGlobalPool to collect the desired kind first, if none is
found, to collect the other kind. This avoids the need to call both
LookupFactoryMethodInGlobalPool and LookupInstanceMethodInGlobalPool.

llvm-svn: 265711
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaOverload.cpp