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
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index c71fbca..1e3636c 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -502,13 +502,10 @@
/// 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 @@
// 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 @@
// 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;
}