summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-01-05 01:40:08 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-01-05 01:40:08 +0000
commit7b1b947ca10a613d583ffa7c399575cd70946b81 (patch)
tree81b33c803d8f827623a0837ce5a5a58a08abe1fe
parent6ec78274df2f8de1fe3c99a54e168c8d4ccf5cf5 (diff)
downloadbcm5719-llvm-7b1b947ca10a613d583ffa7c399575cd70946b81.tar.gz
bcm5719-llvm-7b1b947ca10a613d583ffa7c399575cd70946b81.zip
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) . llvm-svn: 45615
-rw-r--r--clang/Sema/SemaStmt.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index 81eb0b0060f..ab40e708e36 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -543,14 +543,9 @@ Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc,
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();
OpenPOWER on IntegriCloud