r195561 - Use specific_attr_iterator to tighten loop over ObjCSuppressProtocolAttrs.

Ted Kremenek kremenek at apple.com
Sat Nov 23 14:51:37 PST 2013


Author: kremenek
Date: Sat Nov 23 16:51:36 2013
New Revision: 195561

URL: http://llvm.org/viewvc/llvm-project?rev=195561&view=rev
Log:
Use specific_attr_iterator to tighten loop over ObjCSuppressProtocolAttrs.

Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=195561&r1=195560&r2=195561&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat Nov 23 16:51:36 2013
@@ -259,16 +259,12 @@ 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) {
+  for (specific_attr_iterator<ObjCSuppressProtocolAttr>
+        I = specific_attr_begin<ObjCSuppressProtocolAttr>(),
+        E = specific_attr_end<ObjCSuppressProtocolAttr>(); I != E; ++I)
+      if ((*I)->getProtocol() == PI)
         return true;
-      }
-    }
-  }
   return false;
 }
 





More information about the cfe-commits mailing list