summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-08-08 02:45:18 +0000
committerTed Kremenek <kremenek@apple.com>2008-08-08 02:45:18 +0000
commit4a35180f6d07bc2af7d8901a04d68d47bfccc8ee (patch)
treeeefe892cf6569d3f2737d80ed31df0d274364aa1 /clang/lib/Sema/SemaStmt.cpp
parent4b1327960d65d6bf5dd24992824e65a493855ada (diff)
downloadbcm5719-llvm-4a35180f6d07bc2af7d8901a04d68d47bfccc8ee.tar.gz
bcm5719-llvm-4a35180f6d07bc2af7d8901a04d68d47bfccc8ee.zip
Use DeclStmt::decl_iterator instead of walking the getNextDeclarator() chain.
llvm-svn: 54501
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index e743810ed41..5065bb9bc6d 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/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!
}
}
OpenPOWER on IntegriCloud