diff options
author | Steve Naroff <snaroff@apple.com> | 2007-11-12 22:05:31 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-11-12 22:05:31 +0000 |
commit | e1e6c0d5c79c0ee7ed62fef47a19aa7ecef40db4 (patch) | |
tree | 64e8a32cb662b3a09d2a050252840b829714a266 /include/clang | |
parent | cffff840075f6d10387b965fabd2de38802fc85f (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 'include/clang')
-rw-r--r-- | include/clang/AST/DeclObjC.h | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index db40ba904b..9320c60d25 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -572,36 +572,47 @@ class ObjcCategoryImplDecl : public NamedDecl { /// Class interface for this category implementation ObjcInterfaceDecl *ClassInterface; - /// category instance methods being implemented - ObjcMethodDecl **InstanceMethods; // Null if category is not implementing any - int NumInstanceMethods; // -1 if category is not implementing any - - /// category class methods being implemented - ObjcMethodDecl **ClassMethods; // Null if category is not implementing any - int NumClassMethods; // -1 if category is not implementing any + /// implemented instance methods + llvm::SmallVector<ObjcMethodDecl*, 32> InstanceMethods; - public: + /// implemented class methods + llvm::SmallVector<ObjcMethodDecl*, 32> ClassMethods; + + SourceLocation EndLoc; +public: ObjcCategoryImplDecl(SourceLocation L, IdentifierInfo *Id, ObjcInterfaceDecl *classInterface) : NamedDecl(ObjcCategoryImpl, L, Id), - ClassInterface(classInterface), - InstanceMethods(0), NumInstanceMethods(-1), - ClassMethods(0), NumClassMethods(-1) {} + ClassInterface(classInterface) {} - ObjcInterfaceDecl *getClassInterface() const { - return ClassInterface; - } - - ObjcMethodDecl **getInstanceMethods() const { return InstanceMethods; } - int getNumInstanceMethods() const { return NumInstanceMethods; } - - ObjcMethodDecl **getClassMethods() const { return ClassMethods; } - int getNumClassMethods() const { return NumClassMethods; } + ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; } - void addMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers, - ObjcMethodDecl **clsMethods, unsigned numClsMembers, - SourceLocation AtEndLoc); + // FIXME: Figure out how to remove the const pointer below. + ObjcMethodDecl *const*getInstanceMethods() const { + return &InstanceMethods[0]; + } + int getNumInstanceMethods() const { return InstanceMethods.size(); } + // FIXME: Figure out how to remove the const pointer below. + ObjcMethodDecl *const*getClassMethods() const { + return &ClassMethods[0]; + } + int getNumClassMethods() const { return ClassMethods.size(); } + + void addInstanceMethod(ObjcMethodDecl *method) { + InstanceMethods.push_back(method); + } + void addClassMethod(ObjcMethodDecl *method) { + ClassMethods.push_back(method); + } + ObjcMethodDecl *lookupInstanceMethod(Selector &Sel); + ObjcMethodDecl *lookupClassMethod(Selector &Sel); + + // Location information, modeled after the Stmt API. + SourceLocation getLocStart() const { return getLocation(); } + SourceLocation getLocEnd() const { return EndLoc; } + void setLocEnd(SourceLocation LE) { EndLoc = LE; }; + static bool classof(const Decl *D) { return D->getKind() == ObjcCategoryImpl;} static bool classof(const ObjcCategoryImplDecl *D) { return true; } }; |