Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.

Also, fix a subtle bug, which occurred due to lookupPrivateMethod
defined in DeclObjC.h not looking up the method inside parent's
categories.

Note, the code assumes that Class's parent object has the same methods
as what's in the Root class of a the hierarchy, which is a heuristic
that might not hold for hierarchies which do not descend from NSObject.
Would be great to fix this in the future.

llvm-svn: 160885
This commit is contained in:
Anna Zaks
2012-07-27 19:07:44 +00:00
parent 8e3b260313
commit c77a3b1aab
8 changed files with 59 additions and 83 deletions

View File

@@ -1481,7 +1481,7 @@ Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
// If there's an interface, look in both the public and private APIs.
if (iface) {
method = iface->lookupInstanceMethod(selector);
if (!method) method = LookupPrivateInstanceMethod(selector, iface);
if (!method) method = iface->lookupPrivateMethod(selector);
}
// Also check protocol qualifiers.