r240245 - Sema: convert decl + while loop into for loop (NFC)

Saleem Abdulrasool compnerd at compnerd.org
Sun Jun 21 11:20:01 PDT 2015


Author: compnerd
Date: Sun Jun 21 13:20:01 2015
New Revision: 240245

URL: http://llvm.org/viewvc/llvm-project?rev=240245&view=rev
Log:
Sema: convert decl + while loop into for loop (NFC)

Convert a hand rolled for loop into an explicit for loop.  NFC.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=240245&r1=240244&r2=240245&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun Jun 21 13:20:01 2015
@@ -3808,15 +3808,14 @@ Decl *Sema::ParsedFreeStandingDeclSpec(S
         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();
       }
     }
   }





More information about the cfe-commits mailing list