Catch a foreach parse error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62382 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8d4705a..be929ae 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -364,6 +364,11 @@
if (Tok.is(tok::semi)) {
ConsumeToken();
+ // for(is key; in keys) is error.
+ if (D.getContext() == Declarator::ForContext && isTokIdentifier_in()) {
+ Diag(Tok, diag::err_parse_error);
+ return 0;
+ }
return Actions.FinalizeDeclaratorGroup(CurScope, LastDeclInGroup);
}
// If this is an ObjC2 for-each loop, this is a successful declarator