diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:30:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:30:05 +0000 |
commit | 0157c5144513438bb74aebf50d18f95df4104acb (patch) | |
tree | 596a2b088f45a52210ab0946889105dd6e6810fb /AST/Decl.cpp | |
parent | 4d3914836e85258e9ace7306999413e3c7ea6c11 (diff) |
start cleaning up interfaces for objc bits and pieces by switching to an
iterator interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r-- | AST/Decl.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp index 188f3255de..c71fbca348 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -406,8 +406,8 @@ ObjcIvarDecl *ObjcInterfaceDecl::lookupInstanceVariable( return NULL; } -// lookupInstanceMethod - This method returns an instance method by looking in -// the class, it's categories, and it's super classes (using a linear search). +/// lookupInstanceMethod - This method returns an instance method by looking in +/// the class, it's categories, and it's super classes (using a linear search). ObjcMethodDecl *ObjcInterfaceDecl::lookupInstanceMethod(Selector &Sel) { ObjcInterfaceDecl* ClassDecl = this; while (ClassDecl != NULL) { @@ -488,24 +488,20 @@ ObjcMethodDecl *ObjcInterfaceDecl::lookupClassMethod(Selector &Sel) { 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 *const*methods = getInstanceMethods(); - int methodCount = getNumInstanceMethods(); - for (int i = 0; i < methodCount; ++i) { - if (methods[i]->getSelector() == Sel) { - return methods[i]; - } - } +/// 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) { + for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) + if ((*I)->getSelector() == Sel) + return *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) { +/// lookupClassMethod - This method returns a class method by looking in +/// the class implementation. Unlike interfaces, we don't look outside the +/// implementation. +ObjcMethodDecl *ObjcImplementationDecl::lookupClassMethod(Selector Sel) { ObjcMethodDecl *const*methods = getClassMethods(); int methodCount = getNumClassMethods(); for (int i = 0; i < methodCount; ++i) { |