diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:46:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-12 07:46:12 +0000 |
commit | ab4c4d5e5ececa77aae7e291fafcba3049319cdc (patch) | |
tree | ed2ded2c97240e3155e474dc07f3ce12445d8efa /AST/Decl.cpp | |
parent | 0157c5144513438bb74aebf50d18f95df4104acb (diff) |
resolve some fixmes and clean up some code by eliminating the get*Vars apis to some classes and use iterators instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r-- | AST/Decl.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp index c71fbca348..1e3636c2d5 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -502,13 +502,10 @@ ObjcMethodDecl *ObjcImplementationDecl::lookupInstanceMethod(Selector Sel) { /// 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) { - if (methods[i]->getSelector() == Sel) { - return methods[i]; - } - } + for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); + I != E; ++I) + if ((*I)->getSelector() == Sel) + return *I; return NULL; } @@ -516,13 +513,9 @@ ObjcMethodDecl *ObjcImplementationDecl::lookupClassMethod(Selector Sel) { // the class implementation. Unlike interfaces, we don't look outside the // implementation. ObjcMethodDecl *ObjcCategoryImplDecl::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]; - } - } + for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) + if ((*I)->getSelector() == Sel) + return *I; return NULL; } @@ -530,13 +523,10 @@ ObjcMethodDecl *ObjcCategoryImplDecl::lookupInstanceMethod(Selector &Sel) { // the class implementation. Unlike interfaces, we don't look outside the // implementation. ObjcMethodDecl *ObjcCategoryImplDecl::lookupClassMethod(Selector &Sel) { - ObjcMethodDecl *const*methods = getClassMethods(); - int methodCount = getNumClassMethods(); - for (int i = 0; i < methodCount; ++i) { - if (methods[i]->getSelector() == Sel) { - return methods[i]; - } - } + for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); + I != E; ++I) + if ((*I)->getSelector() == Sel) + return *I; return NULL; } |