diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-08 02:45:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-08 02:45:18 +0000 |
commit | 909cd267dd8f66867c0aaef3bef052dc27bde47c (patch) | |
tree | 271771a57613a9e4ba13c652ab7dc6b9576da385 | |
parent | 2619be072ccc6a722278d1ec39b98eae068d3da3 (diff) |
Use DeclStmt::decl_iterator instead of walking the getNextDeclarator() chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54501 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index e743810ed4..5065bb9bc6 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -526,13 +526,13 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, 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! } } |