diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-28 05:11:05 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-28 05:11:05 +0000 |
commit | 4292073a858f72769fa405b48390620c8932f8ae (patch) | |
tree | f45f097b6c5a0316b05e5f5408f00a91056c81bb /lib/AST/DeclObjC.cpp | |
parent | a8530375168f578e9039837c58054d55655c981b (diff) |
-Add ObjCCategoryImplDecl::getCategoryClass() which returns the category interface decl.
-Correct ObjCMethodDecl::getNextRedeclaration(); A method in a ObjCCategoryImplDecl should point to
a method in the associated ObjCCategoryDecl, not the ObjCInterfaceDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 503bc7052d..0a284816d8 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -233,9 +233,15 @@ ObjCMethodDecl *ObjCMethodDecl::getNextRedeclaration() { if (ObjCCategoryImplDecl *ImplD = Ctx.getObjCImplementation(CD)) Redecl = ImplD->getMethod(getSelector(), isInstanceMethod()); - } else if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(CtxD)) { + } else if (ObjCImplementationDecl *ImplD = + dyn_cast<ObjCImplementationDecl>(CtxD)) { if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface()) Redecl = IFD->getMethod(getSelector(), isInstanceMethod()); + + } else if (ObjCCategoryImplDecl *CImplD = + dyn_cast<ObjCCategoryImplDecl>(CtxD)) { + if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass()) + Redecl = CatD->getMethod(getSelector(), isInstanceMethod()); } return Redecl ? Redecl : this; @@ -532,6 +538,10 @@ ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC, return new (C) ObjCCategoryImplDecl(DC, L, Id, ClassInterface); } +ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryClass() const { + return getClassInterface()->FindCategoryDeclaration(getIdentifier()); +} + void ObjCImplDecl::addPropertyImplementation(ObjCPropertyImplDecl *property) { // FIXME: The context should be correct before we get here. |