aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-25 22:16:03 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-25 22:16:03 +0000
commit16f06bb41b1b02ff0847bc41b89818472053d672 (patch)
tree4868dbec1eb9227a2f07b65f355f467b13893382 /lib/AST/DeclObjC.cpp
parentaa5420c1e36ab8e0e4bb87239d8b73a3a8ce75db (diff)
Refactor ObjCImplDecl::getInstanceMethod/getClassMethod into one
ObjCImplDecl::getMethod. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77094 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 7b3c853215..d9005f8f3c 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/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<ObjCMethodDecl>(*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<ObjCMethodDecl>(*Meth);
- if (MD && MD->isClassMethod())
+ if (MD && MD->isInstanceMethod() == isInstance)
return MD;
}
return 0;