]> granicus.if.org Git - clang/commitdiff
Use specific_attr_iterator to tighten loop over ObjCSuppressProtocolAttrs.
authorTed Kremenek <kremenek@apple.com>
Sat, 23 Nov 2013 22:51:36 +0000 (22:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 23 Nov 2013 22:51:36 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195561 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp

index 69de6a3c859b38ece523721f790aace30f66b33a..cc3459476adc7dbc7a4ede2ff60695c59b1cccaf 100644 (file)
@@ -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;
 }