]> granicus.if.org Git - clang/commitdiff
Sema: convert decl + while loop into for loop (NFC)
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 21 Jun 2015 18:20:01 +0000 (18:20 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 21 Jun 2015 18:20:01 +0000 (18:20 +0000)
Convert a hand rolled for loop into an explicit for loop.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240245 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index aa006b31fc8988ac82d6b848b0c2a0a5ec5840af..df8e38ff66812f9b31f0fe4edc94ec056504f768 100644 (file)
@@ -3808,15 +3808,14 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
         TypeSpecType == DeclSpec::TST_interface ||
         TypeSpecType == DeclSpec::TST_union ||
         TypeSpecType == DeclSpec::TST_enum) {
-      AttributeList* attrs = DS.getAttributes().getList();
-      while (attrs) {
+      for (AttributeList* attrs = DS.getAttributes().getList(); attrs;
+           attrs = attrs->getNext()) {
         Diag(attrs->getLoc(), diag::warn_declspec_attribute_ignored)
         << attrs->getName()
         << (TypeSpecType == DeclSpec::TST_class ? 0 :
             TypeSpecType == DeclSpec::TST_struct ? 1 :
             TypeSpecType == DeclSpec::TST_union ? 2 :
             TypeSpecType == DeclSpec::TST_interface ? 3 : 4);
-        attrs = attrs->getNext();
       }
     }
   }