twiks based on Chris's comment. No need to iterate thru a list of declarations
in a foreach-statement which is illegal (but not yet caught) .


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45615 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaStmt.cpp b/Sema/SemaStmt.cpp
index 81eb0b0..ab40e70 100644
--- a/Sema/SemaStmt.cpp
+++ b/Sema/SemaStmt.cpp
@@ -543,14 +543,9 @@
     FirstType = cast<ValueDecl>(DS->getDecl())->getType();
     // C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
     // identifiers for objects having storage class 'auto' or 'register'.
-    for (ScopedDecl *D = DS->getDecl(); D; D = D->getNextDeclarator()) {
-      BlockVarDecl *BVD = cast<BlockVarDecl>(D);
-      if (BVD && !BVD->hasLocalStorage())
-        BVD = 0;
-      if (BVD == 0)
-        return Diag(cast<ScopedDecl>(D)->getLocation(), 
-                    diag::err_non_variable_decl_in_for);
-    }
+    BlockVarDecl *BVD = cast<BlockVarDecl>(DS->getDecl());
+    if (!BVD->hasLocalStorage())
+      return Diag(BVD->getLocation(), diag::err_non_variable_decl_in_for);
   }
   else
     FirstType = static_cast<Expr*>(first)->getType();