aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/DeclObjC.h2
-rw-r--r--lib/AST/DeclObjC.cpp12
2 files changed, 13 insertions, 1 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index f21d913e63..6dfbcfd00c 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -918,6 +918,8 @@ public:
return Id;
}
void setIdentifier(IdentifierInfo *II) { Id = II; }
+
+ ObjCCategoryDecl *getCategoryClass() const;
/// getNameAsCString - Get the name of identifier for the class
/// interface associated with this implementation as a C string
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.