[cfe-commits] r45615 - /cfe/trunk/Sema/SemaStmt.cpp
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 4 17:40:08 PST 2008
Author: fjahanian
Date: Fri Jan 4 19:40:08 2008
New Revision: 45615
URL: http://llvm.org/viewvc/llvm-project?rev=45615&view=rev
Log:
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) .
Modified:
cfe/trunk/Sema/SemaStmt.cpp
Modified: cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaStmt.cpp?rev=45615&r1=45614&r2=45615&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/Sema/SemaStmt.cpp Fri Jan 4 19:40:08 2008
@@ -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();
More information about the cfe-commits
mailing list