summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-03-31 20:22:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-03-31 20:22:35 +0000
commit083712fbb710aaca155533df00799aaa6ebcbb71 (patch)
treea39ca6de631c830e680fcc279971c39197ca269f
parent0208535fdafbe5525d33dd8525f6b8dc028170e7 (diff)
downloadbcm5719-llvm-083712fbb710aaca155533df00799aaa6ebcbb71.tar.gz
bcm5719-llvm-083712fbb710aaca155533df00799aaa6ebcbb71.zip
Issue better syntax error when objc's messaging
ares are not separated by ':' (radar 7030268). llvm-svn: 100040
-rw-r--r--clang/lib/Parse/ParseObjc.cpp7
-rw-r--r--clang/test/Parser/objc-messaging-neg-1.m6
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 2d43f15cba9..9a3473f042e 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/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/clang/test/Parser/objc-messaging-neg-1.m b/clang/test/Parser/objc-messaging-neg-1.m
index 0d0cb9d8d6f..4ddadb816f0 100644
--- a/clang/test/Parser/objc-messaging-neg-1.m
+++ b/clang/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 ':'}}
}
OpenPOWER on IntegriCloud