diff options
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r-- | AST/Decl.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp index d23f3cb6f3..9e02607cf3 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -408,4 +408,36 @@ void ObjcImplementationDecl::ObjcAddImplMethods(ObjcMethodDecl **insMethods, } } +// FIXME: look through categories... +ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector &Sel) { + ObjcInterfaceDecl* ClassDecl = this; + while (ClassDecl != NULL) { + ObjcMethodDecl **methods = ClassDecl->getInsMethods(); + int methodCount = ClassDecl->getNumInsMethods(); + for (int i = 0; i < methodCount; ++i) { + if (methods[i]->getSelector() == Sel) { + return methods[i]; + } + } + ClassDecl = ClassDecl->getSuperClass(); + } + return NULL; +} + +// FIXME: look through categories... +ObjcMethodDecl *ObjcInterfaceDecl::lookupClassMethod(Selector &Sel) { + ObjcInterfaceDecl* ClassDecl = this; + while (ClassDecl != NULL) { + ObjcMethodDecl **methods = ClassDecl->getClsMethods(); + int methodCount = ClassDecl->getNumClsMethods(); + for (int i = 0; i < methodCount; ++i) { + if (methods[i]->getSelector() == Sel) { + return methods[i]; + } + } + ClassDecl = ClassDecl->getSuperClass(); + } + return NULL; +} + |