[cfe-commits] r54501 - /cfe/trunk/lib/Sema/SemaStmt.cpp
Ted Kremenek
kremenek at apple.com
Thu Aug 7 19:45:20 PDT 2008
Author: kremenek
Date: Thu Aug 7 21:45:18 2008
New Revision: 54501
URL: http://llvm.org/viewvc/llvm-project?rev=54501&view=rev
Log:
Use DeclStmt::decl_iterator instead of walking the getNextDeclarator() chain.
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=54501&r1=54500&r2=54501&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu Aug 7 21:45:18 2008
@@ -526,13 +526,13 @@
if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) {
// 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()) {
- VarDecl *VD = dyn_cast<VarDecl>(D);
+ for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
+ DI!=DE; ++DI) {
+ VarDecl *VD = dyn_cast<VarDecl>(*DI);
if (VD && VD->isBlockVarDecl() && !VD->hasLocalStorage())
VD = 0;
if (VD == 0)
- Diag(dyn_cast<ScopedDecl>(D)->getLocation(),
- diag::err_non_variable_decl_in_for);
+ Diag((*DI)->getLocation(), diag::err_non_variable_decl_in_for);
// FIXME: mark decl erroneous!
}
}
More information about the cfe-commits
mailing list