r179784 - Objective-C parsing [qoi]: Provide good recovery when
Fariborz Jahanian
fjahanian at apple.com
Thu Apr 18 12:37:43 PDT 2013
Author: fjahanian
Date: Thu Apr 18 14:37:43 2013
New Revision: 179784
URL: http://llvm.org/viewvc/llvm-project?rev=179784&view=rev
Log:
Objective-C parsing [qoi]: Provide good recovery when
Objective-C dictionary literals has bad syntax for the
separator. // rdar://10679157
Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/Parser/objc-boxing.m
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=179784&r1=179783&r2=179784&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Thu Apr 18 14:37:43 2013
@@ -2747,7 +2747,9 @@ ExprResult Parser::ParseObjCDictionaryLi
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());
Modified: cfe/trunk/test/Parser/objc-boxing.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-boxing.m?rev=179784&r1=179783&r2=179784&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-boxing.m (original)
+++ cfe/trunk/test/Parser/objc-boxing.m Thu Apr 18 14:37:43 2013
@@ -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);
+}
More information about the cfe-commits
mailing list