Issue better syntax error when objc's messaging

ares are not separated by ':' (radar 7030268).

llvm-svn: 100040
This commit is contained in:
Fariborz Jahanian 2010-03-31 20:22:35 +00:00
parent 0208535fda
commit 083712fbb7
2 changed files with 11 additions and 2 deletions

View File

@ -1819,6 +1819,9 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
}
if (Tok.isNot(tok::r_square)) {
if (Tok.is(tok::identifier))
Diag(Tok, diag::err_expected_colon);
else
Diag(Tok, diag::err_expected_rsquare);
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond

View File

@ -1,6 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
+(void) foo:(int) a;
@end
int main() {
id a;
[a bla:0 6:7]; // expected-error {{expected ']'}}
[A foo bar]; // expected-error {{expected ':'}}
[A foo bar bar1]; // expected-error {{expected ':'}}
}