diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-31 20:22:35 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-31 20:22:35 +0000 |
commit | 809872eca7f6c024e2ab41ddffbbeeae807bf5dc (patch) | |
tree | 1f3748514991044853ad3aba84b4ad6258d690d1 | |
parent | 4a2023f5014e82389d5980d307b89c545dbbac81 (diff) |
Issue better syntax error when objc's messaging
ares are not separated by ':' (radar 7030268).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100040 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 7 | ||||
-rw-r--r-- | test/Parser/objc-messaging-neg-1.m | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 2d43f15cba..9a3473f042 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1817,9 +1817,12 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, SkipUntil(tok::r_square); return ExprError(); } - + if (Tok.isNot(tok::r_square)) { - Diag(Tok, diag::err_expected_rsquare); + 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 // the enclosing expression. diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m index 0d0cb9d8d6..4ddadb816f 100644 --- a/test/Parser/objc-messaging-neg-1.m +++ b/test/Parser/objc-messaging-neg-1.m @@ -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 ':'}} } |