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
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index 188f325..c71fbca 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -406,8 +406,8 @@
   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 @@
   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) {
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index 4a4bcf1..d9d17b3 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -589,12 +589,34 @@
   }
   int getNumClassMethods() const { return ClassMethods.size(); }
 
-  ObjcMethodDecl *lookupInstanceMethod(Selector &Sel);
-  ObjcMethodDecl *lookupClassMethod(Selector &Sel);
-  
   ObjcIvarDecl **getImplDeclIVars() const { return Ivars; }
   int getImplDeclNumIvars() const { return NumIvars; }
-    
+  
+  
+  typedef llvm::SmallVector<ObjcMethodDecl*, 32>::const_iterator
+       instmeth_iterator;
+  instmeth_iterator instmeth_begin() const { return InstanceMethods.begin(); }
+  instmeth_iterator instmeth_end() const { return InstanceMethods.end(); }
+
+  typedef llvm::SmallVector<ObjcMethodDecl*, 32>::const_iterator
+    classmeth_iterator;
+  classmeth_iterator classmeth_begin() const { return ClassMethods.begin(); }
+  classmeth_iterator classmeth_end() const { return ClassMethods.end(); }
+  
+  /// lookupInstanceMethod - This method returns an instance method by looking
+  /// in the class implementation. Unlike interfaces, we don't look outside the
+  /// implementation.
+  ObjcMethodDecl *lookupInstanceMethod(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 *lookupClassMethod(Selector Sel);
+  
+  typedef ObjcIvarDecl * const *ivar_iterator;
+  ivar_iterator ivar_begin() const { return Ivars; }
+  ivar_iterator ivar_end() const { return Ivars+NumIvars; }
+  
   static bool classof(const Decl *D) {
     return D->getKind() == ObjcImplementation;
   }