summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-28 05:11:17 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-28 05:11:17 +0000
commitf390c43c3c63f2ff9aa51e9d6df1d3c72ccbc91a (patch)
treee3c38b9dbd4f0663ab18297a61ee9c54b0a4ec8e /clang/lib/AST/DeclObjC.cpp
parenta56fa19ac6899bf21d819c74f422df9266ffdcac (diff)
downloadbcm5719-llvm-f390c43c3c63f2ff9aa51e9d6df1d3c72ccbc91a.tar.gz
bcm5719-llvm-f390c43c3c63f2ff9aa51e9d6df1d3c72ccbc91a.zip
Implement ObjCMethodDecl::getCanonicalDecl().
llvm-svn: 77298
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 0a284816d8c..125c94194cb 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -247,6 +247,26 @@ ObjCMethodDecl *ObjCMethodDecl::getNextRedeclaration() {
return Redecl ? Redecl : this;
}
+ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
+ Decl *CtxD = cast<Decl>(getDeclContext());
+
+ if (ObjCImplementationDecl *ImplD = dyn_cast<ObjCImplementationDecl>(CtxD)) {
+ if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface())
+ if (ObjCMethodDecl *MD = IFD->getMethod(getSelector(),
+ isInstanceMethod()))
+ return MD;
+
+ } else if (ObjCCategoryImplDecl *CImplD =
+ dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
+ if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass())
+ if (ObjCMethodDecl *MD = CatD->getMethod(getSelector(),
+ isInstanceMethod()))
+ return MD;
+ }
+
+ return this;
+}
+
void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
const ObjCInterfaceDecl *OID) {
QualType selfTy;
OpenPOWER on IntegriCloud