summaryrefslogtreecommitdiffstats
path: root/clang/Sema
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-01-07 17:52:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-01-07 17:52:35 +0000
commitfef287cb676236f70a12462482addf3d412981a2 (patch)
tree679ab47686c29f62cf874683875ec23ec4abffcd /clang/Sema
parent281653b25ebe2c5c908b11fa00f37874f29eddbf (diff)
downloadbcm5719-llvm-fef287cb676236f70a12462482addf3d412981a2.tar.gz
bcm5719-llvm-fef287cb676236f70a12462482addf3d412981a2.zip
Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
llvm-svn: 45708
Diffstat (limited to 'clang/Sema')
-rw-r--r--clang/Sema/SemaStmt.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/Sema/SemaStmt.cpp b/clang/Sema/SemaStmt.cpp
index ab40e708e36..7219db2621e 100644
--- a/clang/Sema/SemaStmt.cpp
+++ b/clang/Sema/SemaStmt.cpp
@@ -543,9 +543,12 @@ 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'.
- BlockVarDecl *BVD = cast<BlockVarDecl>(DS->getDecl());
+ ScopedDecl *D = DS->getDecl();
+ BlockVarDecl *BVD = cast<BlockVarDecl>(D);
if (!BVD->hasLocalStorage())
return Diag(BVD->getLocation(), diag::err_non_variable_decl_in_for);
+ if (D->getNextDeclarator())
+ return Diag(D->getLocation(), diag::err_toomany_element_decls);
}
else
FirstType = static_cast<Expr*>(first)->getType();
OpenPOWER on IntegriCloud