]> granicus.if.org Git - clang/commitdiff
Issue better syntax error when objc's messaging
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 31 Mar 2010 20:22:35 +0000 (20:22 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 31 Mar 2010 20:22:35 +0000 (20:22 +0000)
ares are not separated by ':' (radar 7030268).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100040 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/Parser/objc-messaging-neg-1.m

index 2d43f15cba99aeea81f62de9b3c2c388571cdf72..9a3473f042ed560af0ad5a2c91342ab1767998a5 100644 (file)
@@ -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.
index 0d0cb9d8d6fea6957576812c24ef7c4e251dec42..4ddadb816f0df4c45c56266dd4d04d39aab57995 100644 (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 ':'}}
 }