summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-28 05:11:05 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-28 05:11:05 +0000
commita56fa19ac6899bf21d819c74f422df9266ffdcac (patch)
tree51a867625f49a5a729cbf1280d5d76162394877d /clang/lib/AST/DeclObjC.cpp
parent2cee40daa7ef3c48276e6bb6a8e0608db248b34f (diff)
downloadbcm5719-llvm-a56fa19ac6899bf21d819c74f422df9266ffdcac.tar.gz
bcm5719-llvm-a56fa19ac6899bf21d819c74f422df9266ffdcac.zip
-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. llvm-svn: 77297
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 503bc7052dc..0a284816d8c 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud