summaryrefslogtreecommitdiffstats
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
parenta56fa19ac6899bf21d819c74f422df9266ffdcac (diff)
downloadbcm5719-llvm-f390c43c3c63f2ff9aa51e9d6df1d3c72ccbc91a.tar.gz
bcm5719-llvm-f390c43c3c63f2ff9aa51e9d6df1d3c72ccbc91a.zip
Implement ObjCMethodDecl::getCanonicalDecl().
llvm-svn: 77298
-rw-r--r--clang/include/clang/AST/DeclObjC.h4
-rw-r--r--clang/lib/AST/DeclObjC.cpp20
2 files changed, 23 insertions, 1 deletions
diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h
index 6dfbcfd00c0..2a1b826bad8 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -173,7 +173,9 @@ public:
bool isVariadic = false,
bool isSynthesized = false,
ImplementationControl impControl = None);
-
+
+ virtual ObjCMethodDecl *getCanonicalDecl();
+
ObjCDeclQualifier getObjCDeclQualifier() const {
return ObjCDeclQualifier(objcDeclQualifier);
}
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