diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-11-23 22:29:06 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-11-23 22:29:06 +0000 |
commit | 33f504328f126a1ddbb35a1f2686c7ccf68c7400 (patch) | |
tree | 15d5bc36a394dd8aadcd90fbc16de5888f6067b0 /clang/lib/AST/DeclObjC.cpp | |
parent | d480b1bf343df7a4970a44d3dd5a634c92d4c065 (diff) | |
download | bcm5719-llvm-33f504328f126a1ddbb35a1f2686c7ccf68c7400.tar.gz bcm5719-llvm-33f504328f126a1ddbb35a1f2686c7ccf68c7400.zip |
Move logic to check if a class is tagged with objc_suppress_protocol_methods into a helper.
llvm-svn: 195559
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index a4857b60731..69de6a3c859 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -256,6 +256,22 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { void ObjCInterfaceDecl::anchor() { } +bool ObjCInterfaceDecl::shouldSuppressProtocol(const ObjCProtocolDecl *P) const{ + if (!hasAttrs()) + return false; + const AttrVec &V = getAttrs(); + const IdentifierInfo *PI = P->getIdentifier(); + for (AttrVec::const_iterator I = V.begin(), E = V.end(); I != E; ++I) { + if (const ObjCSuppressProtocolAttr *A = + dyn_cast<ObjCSuppressProtocolAttr>(*I)){ + if (A->getProtocol() == PI) { + return true; + } + } + } + return false; +} + /// FindPropertyVisibleInPrimaryClass - Finds declaration of the property /// with name 'PropertyId' in the primary class; including those in protocols /// (direct or indirect) used by the primary class. @@ -477,18 +493,8 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, // If we are looking for a method that is part of protocol conformance, // check if the superclass has been marked to suppress conformance // of that protocol. - if (P && ClassDecl->hasAttrs()) { - const AttrVec &V = ClassDecl->getAttrs(); - const IdentifierInfo *PI = P->getIdentifier(); - for (AttrVec::const_iterator I = V.begin(), E = V.end(); I != E; ++I) { - if (const ObjCSuppressProtocolAttr *A = - dyn_cast<ObjCSuppressProtocolAttr>(*I)){ - if (A->getProtocol() == PI) { - return 0; - } - } - } - } + if (P && ClassDecl->shouldSuppressProtocol(P)) + return 0; if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance))) return MethodDecl; |