aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-04-18 19:37:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-04-18 19:37:43 +0000
commit0ac0ee9be071c796b0f05392b473234b884c0ae8 (patch)
tree71445da2d8d908436b995502a94469c8e410e11f
parentd333e7be00bd8bceac0989d7877589d85ceae7da (diff)
Objective-C parsing [qoi]: Provide good recovery when
Objective-C dictionary literals has bad syntax for the separator. // rdar://10679157 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179784 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseObjc.cpp4
-rw-r--r--test/Parser/objc-boxing.m8
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index ad95dd5821..4adba4f5c5 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -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());
diff --git a/test/Parser/objc-boxing.m b/test/Parser/objc-boxing.m
index a16a137b8f..a6bb0243cf 100644
--- a/test/Parser/objc-boxing.m
+++ b/test/Parser/objc-boxing.m
@@ -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);
+}