aboutsummaryrefslogtreecommitdiff
path: root/AST/Decl.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-11-12 22:05:31 +0000
committerSteve Naroff <snaroff@apple.com>2007-11-12 22:05:31 +0000
commite1e6c0d5c79c0ee7ed62fef47a19aa7ecef40db4 (patch)
tree64e8a32cb662b3a09d2a050252840b829714a266 /AST/Decl.cpp
parentcffff840075f6d10387b965fabd2de38802fc85f (diff)
Add category method definitions incrementally, removing a FIXME (like we do for class implementations).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'AST/Decl.cpp')
-rw-r--r--AST/Decl.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index b09960eab1..b7f85e9a53 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -388,26 +388,6 @@ void ObjcCategoryDecl::addMethods(ObjcMethodDecl **insMethods,
AtEndLoc = endLoc;
}
-/// addMethods - Insert instance and methods declarations into
-/// ObjcCategoryImplDecl's CatInsMethods and CatClsMethods fields.
-///
-void ObjcCategoryImplDecl::addMethods(ObjcMethodDecl **insMethods,
- unsigned numInsMembers,
- ObjcMethodDecl **clsMethods,
- unsigned numClsMembers,
- SourceLocation AtEndLoc) {
- NumInstanceMethods = numInsMembers;
- if (numInsMembers) {
- InstanceMethods = new ObjcMethodDecl*[numInsMembers];
- memcpy(InstanceMethods, insMethods, numInsMembers*sizeof(ObjcMethodDecl*));
- }
- NumClassMethods = numClsMembers;
- if (numClsMembers) {
- ClassMethods = new ObjcMethodDecl*[numClsMembers];
- memcpy(ClassMethods, clsMethods, numClsMembers*sizeof(ObjcMethodDecl*));
- }
-}
-
ObjcIvarDecl *ObjcInterfaceDecl::lookupInstanceVariable(
IdentifierInfo *ID, ObjcInterfaceDecl *&clsDeclared) {
ObjcInterfaceDecl* ClassDecl = this;
@@ -535,3 +515,30 @@ ObjcMethodDecl *ObjcImplementationDecl::lookupClassMethod(Selector &Sel) {
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 *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];
+ }
+ }
+ 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 *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];
+ }
+ }
+ return NULL;
+}