Objective-C parsing [qoi]: Provide good recovery when

Objective-C dictionary literals has bad syntax for the
separator. // rdar://10679157

llvm-svn: 179784
This commit is contained in:
Fariborz Jahanian 2013-04-18 19:37:43 +00:00
parent 0c95efad7e
commit 507a5f8cb3
2 changed files with 11 additions and 1 deletions

View File

@ -2747,7 +2747,9 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) {
if (Tok.is(tok::colon)) {
ConsumeToken();
} else {
return ExprError(Diag(Tok, diag::err_expected_colon));
Diag(Tok, diag::err_expected_colon);
SkipUntil(tok::r_brace);
return ExprError();
}
ExprResult ValueExpr(ParseAssignmentExpression());

View File

@ -24,3 +24,11 @@ id missing_parentheses() {
return @(5; // expected-error {{expected ')'}} \
// expected-note {{to match this '('}}
}
// rdar://10679157
void bar(id p);
void foo(id p) {
bar(@{p, p}); // expected-error {{expected ':'}}
bar(0);
bar(0);
}