r195559 - Move logic to check if a class is tagged with objc_suppress_protocol_methods into a helper.
Ted Kremenek
kremenek at apple.com
Sat Nov 23 14:29:06 PST 2013
Author: kremenek
Date: Sat Nov 23 16:29:06 2013
New Revision: 195559
URL: http://llvm.org/viewvc/llvm-project?rev=195559&view=rev
Log:
Move logic to check if a class is tagged with objc_suppress_protocol_methods into a helper.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=195559&r1=195558&r2=195559&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sat Nov 23 16:29:06 2013
@@ -925,6 +925,10 @@ public:
: superCls;
}
+ /// \brief Returns true if this class is marked to suppress being
+ /// used to determine if a subclass conforms to a protocol.
+ bool shouldSuppressProtocol(const ObjCProtocolDecl *P) const;
+
/// \brief Iterator that walks over the list of categories, filtering out
/// those that do not meet specific criteria.
///
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=195559&r1=195558&r2=195559&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat Nov 23 16:29:06 2013
@@ -256,6 +256,22 @@ ObjCContainerDecl::FindPropertyDeclarati
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::looku
// 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;
More information about the cfe-commits
mailing list