diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-15 21:22:08 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-15 21:22:08 +0000 |
commit | d36150d7ca4aadcd533d8bad9cace2f3bc5cf785 (patch) | |
tree | d9a9dc7d09e900a835b9c53b465aeb8593a1135d /clang/lib/AST/ASTContext.cpp | |
parent | 786928dbd24fe38e556fda2c824d267d95a29b2d (diff) | |
download | bcm5719-llvm-d36150d7ca4aadcd533d8bad9cace2f3bc5cf785.tar.gz bcm5719-llvm-d36150d7ca4aadcd533d8bad9cace2f3bc5cf785.zip |
ObjC migrator: finding conforming protocol
candidates for each class. wip.
llvm-svn: 186349
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 8984c3c96dd..8a252f8e73b 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -8129,3 +8129,35 @@ ASTContext::getParents(const ast_type_traits::DynTypedNode &Node) { } return I->second; } + +bool +ASTContext::ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, + const ObjCMethodDecl *MethodImpl) { + // No point trying to match an unavailable/deprecated mothod. + if (MethodDecl->hasAttr<UnavailableAttr>() + || MethodDecl->hasAttr<DeprecatedAttr>()) + return false; + if (MethodDecl->getObjCDeclQualifier() != + MethodImpl->getObjCDeclQualifier()) + return false; + if (!hasSameType(MethodDecl->getResultType(), + MethodImpl->getResultType())) + return false; + + if (MethodDecl->param_size() != MethodImpl->param_size()) + return false; + + for (ObjCMethodDecl::param_const_iterator IM = MethodImpl->param_begin(), + IF = MethodDecl->param_begin(), EM = MethodImpl->param_end(), + EF = MethodDecl->param_end(); + IM != EM && IF != EF; ++IM, ++IF) { + const ParmVarDecl *DeclVar = (*IF); + const ParmVarDecl *ImplVar = (*IM); + if (ImplVar->getObjCDeclQualifier() != DeclVar->getObjCDeclQualifier()) + return false; + if (!hasSameType(DeclVar->getType(), ImplVar->getType())) + return false; + } + return (MethodDecl->isVariadic() == MethodImpl->isVariadic()); + +} |