From 39c348d91569544c5f1af42d38df30f208cc4884 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 25 Jul 2009 22:16:03 +0000 Subject: Refactor ObjCImplDecl::getInstanceMethod/getClassMethod into one ObjCImplDecl::getMethod. llvm-svn: 77094 --- clang/lib/AST/DeclObjC.cpp | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'clang/lib/AST/DeclObjC.cpp') diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 7b3c853215f..d9005f8f3c3 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -587,10 +587,10 @@ FindPropertyImplDecl(IdentifierInfo *Id) const { return 0; } -// getInstanceMethod - This method returns an instance method by looking in +// getMethod - This method returns an instance/class method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(Selector Sel) const { +ObjCMethodDecl *ObjCImplDecl::getMethod(Selector Sel, bool isInstance) const { // Since instance & class methods can have the same name, the loop below // ensures we get the correct method. // @@ -603,29 +603,7 @@ ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(Selector Sel) const { for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) { ObjCMethodDecl *MD = dyn_cast(*Meth); - if (MD && MD->isInstanceMethod()) - return MD; - } - return 0; -} - -// getClassMethod - This method returns an instance method by looking in -// the class implementation. Unlike interfaces, we don't look outside the -// implementation. -ObjCMethodDecl *ObjCImplDecl::getClassMethod(Selector Sel) const { - // Since instance & class methods can have the same name, the loop below - // ensures we get the correct method. - // - // @interface Whatever - // - (int) class_method; - // + (float) class_method; - // @end - // - lookup_const_iterator Meth, MethEnd; - for (llvm::tie(Meth, MethEnd) = lookup(Sel); - Meth != MethEnd; ++Meth) { - ObjCMethodDecl *MD = dyn_cast(*Meth); - if (MD && MD->isClassMethod()) + if (MD && MD->isInstanceMethod() == isInstance) return MD; } return 0; -- cgit v1.2.3