diff options
author | Steve Naroff <snaroff@apple.com> | 2007-10-02 20:01:56 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-10-02 20:01:56 +0000 |
commit | 6a8a9a41e9067b708498c02180159bafecfa044f (patch) | |
tree | 355a7b76ea5a1426300e76a874da8ebbec593a2e /AST/Decl.cpp | |
parent | 60199032e41216fa2fca635c7a942e5473cdf979 (diff) |
- Add ObjcInterfaceDecl::lookupInstanceMethod(), lookupClassMethod().
- Add ObjcMessageExpr::getSelector(), getClassName().
- Change Sema::getObjCInterfaceDecl() to simply take an IdentifierInfo (no Scope needed).
- Remove FIXME for printing ObjCMessageExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42543 91177308-0d34-0410-b5e6-96231b3b80d8
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; +} + |