Teach Sema::ActOnInstanceMessage() about private methods. That is, methods declared in an implementation (but not listed in the interface).
This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late).
I will complete this later...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43989 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index 3cfe4ae..2e79de3 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -510,4 +510,31 @@
return NULL;
}
+// lookupInstanceMethod - This method returns an instance method by looking in
+// the class implementation. Unlike interfaces, we don't look outside the
+// implementation.
+ObjcMethodDecl *ObjcImplementationDecl::lookupInstanceMethod(Selector &Sel) {
+ ObjcMethodDecl **methods = getInstanceMethods();
+ int methodCount = getNumInstanceMethods();
+ for (int i = 0; i < methodCount; ++i) {
+ if (methods[i]->getSelector() == Sel) {
+ return methods[i];
+ }
+ }
+ return NULL;
+}
+
+// lookupClassMethod - This method returns an instance method by looking in
+// the class implementation. Unlike interfaces, we don't look outside the
+// implementation.
+ObjcMethodDecl *ObjcImplementationDecl::lookupClassMethod(Selector &Sel) {
+ ObjcMethodDecl **methods = getClassMethods();
+ int methodCount = getNumClassMethods();
+ for (int i = 0; i < methodCount; ++i) {
+ if (methods[i]->getSelector() == Sel) {
+ return methods[i];
+ }
+ }
+ return NULL;
+}