diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-28 18:42:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-28 18:42:10 +0000 |
commit | 3aa1861bd8b5121e53379b1a00f9d6ad8dead4f6 (patch) | |
tree | b5d1cd67dce98dab7eba82ea84564387a89b31e9 /lib/AST/DeclObjC.cpp | |
parent | 83c9629291e3f4d4619fa98f8a57e4ec347c6154 (diff) |
"This patch addresses two FIXME on ObjCCategoryImplDecl:
/// FIXME: Like ObjCImplementationDecl, this should not be a NamedDecl!
/// FIXME: Introduce a new common base class for ObjCImplementationDecl and ObjCCategoryImplDecl
It adds an IndentifierInfo ivar to the ObjCCategoryImplDecl, so it can inherits from Decl and not NamedDecl (I'm not sure about the memory management of this ivar).
And now that both ObjCImplementationDecl and ObjCCategoryImplDecl have the same super classes, it allow creation of a common base class: ObjCImplDecl"
Patch by Jean-Daniel Dupas!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 1d2ad16479..bdbcce750d 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -525,7 +525,7 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC, /// properties implemented in this category @implementation block and returns /// the implemented property that uses it. /// -ObjCPropertyImplDecl *ObjCCategoryImplDecl:: +ObjCPropertyImplDecl *ObjCImplDecl:: FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const { for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ ObjCPropertyImplDecl *PID = *i; @@ -540,7 +540,7 @@ FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const { /// added to the list of those properties @synthesized/@dynamic in this /// category @implementation block. /// -ObjCPropertyImplDecl *ObjCCategoryImplDecl:: +ObjCPropertyImplDecl *ObjCImplDecl:: FindPropertyImplDecl(IdentifierInfo *Id) const { for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ ObjCPropertyImplDecl *PID = *i; @@ -550,20 +550,20 @@ FindPropertyImplDecl(IdentifierInfo *Id) const { return 0; } -// lookupInstanceMethod - This method returns an instance method by looking in +// getInstanceMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjCMethodDecl *ObjCCategoryImplDecl::getInstanceMethod(Selector Sel) const { +ObjCMethodDecl *ObjCImplDecl::getInstanceMethod(Selector Sel) const { for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) return *I; return NULL; } -// lookupClassMethod - This method returns an instance method by looking in +// getClassMethod - This method returns an instance method by looking in // the class implementation. Unlike interfaces, we don't look outside the // implementation. -ObjCMethodDecl *ObjCCategoryImplDecl::getClassMethod(Selector Sel) const { +ObjCMethodDecl *ObjCImplDecl::getClassMethod(Selector Sel) const { for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); I != E; ++I) if ((*I)->getSelector() == Sel) @@ -589,56 +589,6 @@ void ObjCImplementationDecl::Destroy(ASTContext &C) { Decl::Destroy(C); } -/// getInstanceMethod - This method returns an instance method by -/// looking in the class implementation. Unlike interfaces, we don't -/// look outside the implementation. -ObjCMethodDecl *ObjCImplementationDecl::getInstanceMethod(Selector Sel) const { - for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I) - if ((*I)->getSelector() == Sel) - return *I; - return NULL; -} - -/// getClassMethod - This method returns a class method by looking in -/// the class implementation. Unlike interfaces, we don't look outside -/// the implementation. -ObjCMethodDecl *ObjCImplementationDecl::getClassMethod(Selector Sel) const { - for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); - I != E; ++I) - if ((*I)->getSelector() == Sel) - return *I; - return NULL; -} - -/// FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl -/// added to the list of those properties @synthesized/@dynamic in this -/// @implementation block. -/// -ObjCPropertyImplDecl *ObjCImplementationDecl:: -FindPropertyImplDecl(IdentifierInfo *Id) const { - for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ - ObjCPropertyImplDecl *PID = *i; - if (PID->getPropertyDecl()->getIdentifier() == Id) - return PID; - } - return 0; -} - -/// FindPropertyImplIvarDecl - This method lookup the ivar in the list of -/// properties implemented in this @implementation block and returns the -/// implemented property that uses it. -/// -ObjCPropertyImplDecl *ObjCImplementationDecl:: -FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const { - for (propimpl_iterator i = propimpl_begin(), e = propimpl_end(); i != e; ++i){ - ObjCPropertyImplDecl *PID = *i; - if (PID->getPropertyIvarDecl() && - PID->getPropertyIvarDecl()->getIdentifier() == ivarId) - return PID; - } - return 0; -} - //===----------------------------------------------------------------------===// // ObjCCompatibleAliasDecl //===----------------------------------------------------------------------===// |