]> granicus.if.org Git - clang/commitdiff
simplify some code.
authorChris Lattner <sabre@nondot.org>
Sat, 14 Feb 2009 08:22:25 +0000 (08:22 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 Feb 2009 08:22:25 +0000 (08:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64548 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp

index 1e87a6f8195b7e06868a711b54eecd4fff5e6a49..95a6faed1aeb9d30160a3b4583ba29b74b92c260 100644 (file)
@@ -264,14 +264,13 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
         << ProtocolId[i].first;
       continue;
     }
-    for (const Attr *attr = PDecl->getAttrs(); attr; attr = attr->getNext()) {
-      if (attr->getKind() == Attr::Unavailable)
-        Diag(ProtocolId[i].second, diag::warn_unavailable) << 
-          PDecl->getDeclName();
-      if (attr->getKind() == Attr::Deprecated)
-        Diag(ProtocolId[i].second, diag::warn_deprecated) << 
-          PDecl->getDeclName();
-    }
+    
+    if (PDecl->getAttr<UnavailableAttr>())
+      Diag(ProtocolId[i].second, diag::warn_unavailable) << 
+           PDecl->getDeclName();
+    if (PDecl->getAttr<DeprecatedAttr>())
+      Diag(ProtocolId[i].second, diag::warn_deprecated) << 
+        PDecl->getDeclName();
 
     // If this is a forward declaration and we are supposed to warn in this
     // case, do it.