summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-25 22:15:22 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-25 22:15:22 +0000
commit6de0560b97844b6c70ce98991383de98b2c2acba (patch)
tree60de82e6643816d11853901f4e08207fb0d4d9b1 /clang/lib/AST/DeclObjC.cpp
parent81db910eb92b596f29d9491677d8a530e1e69851 (diff)
downloadbcm5719-llvm-6de0560b97844b6c70ce98991383de98b2c2acba.tar.gz
bcm5719-llvm-6de0560b97844b6c70ce98991383de98b2c2acba.zip
Refactor ObjCContainerDecl::getInstanceMethod/getClassMethod into one
ObjCContainerDecl::getMethod. Avoids code duplication. llvm-svn: 77091
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp26
1 files changed, 3 insertions, 23 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index e8b6ef5cccc..d5181f75b59 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -54,9 +54,9 @@ ObjCContainerDecl::getIvarDecl(IdentifierInfo *Id) const {
return 0;
}
-// Get the local instance method declared in this interface.
+// Get the local instance/class method declared in this interface.
ObjCMethodDecl *
-ObjCContainerDecl::getInstanceMethod(Selector Sel) const {
+ObjCContainerDecl::getMethod(Selector Sel, bool isInstance) const {
// Since instance & class methods can have the same name, the loop below
// ensures we get the correct method.
//
@@ -68,27 +68,7 @@ ObjCContainerDecl::getInstanceMethod(Selector Sel) const {
lookup_const_iterator Meth, MethEnd;
for (llvm::tie(Meth, MethEnd) = lookup(Sel); Meth != MethEnd; ++Meth) {
ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(*Meth);
- if (MD && MD->isInstanceMethod())
- return MD;
- }
- return 0;
-}
-
-// Get the local class method declared in this interface.
-ObjCMethodDecl *
-ObjCContainerDecl::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<ObjCMethodDecl>(*Meth);
- if (MD && MD->isClassMethod())
+ if (MD && MD->isInstanceMethod() == isInstance)
return MD;
}
return 0;
OpenPOWER on IntegriCloud