summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-11-23 22:29:06 +0000
committerTed Kremenek <kremenek@apple.com>2013-11-23 22:29:06 +0000
commit33f504328f126a1ddbb35a1f2686c7ccf68c7400 (patch)
tree15d5bc36a394dd8aadcd90fbc16de5888f6067b0 /clang/lib/AST/DeclObjC.cpp
parentd480b1bf343df7a4970a44d3dd5a634c92d4c065 (diff)
downloadbcm5719-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.cpp30
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;
OpenPOWER on IntegriCloud