From: Steve Naroff Date: Mon, 12 Nov 2007 19:18:37 +0000 (+0000) Subject: Add an error diagnostic to Parse::ParseObjCMessageExpression(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11508212aacde5199b0475a578a481febf5dc067;p=clang Add an error diagnostic to Parse::ParseObjCMessageExpression(). This now exposes the following bug... ******************** TEST 'Sema/message.m' FAILED! ******************** Command: clang -fsyntax-only -verify Sema/message.m Output: Errors seen but not expected: Line 9: invalid receiver to message expression ******************** TEST 'Sema/message.m' FAILED! ******************** As far as I can tell, all messages to method agruments fail. The method arguments are built by Sema::ObjcActOnStartOfMethodDef(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44022 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp index 7cf551d0ae..c3dae856ea 100644 --- a/Parse/ParseObjc.cpp +++ b/Parse/ParseObjc.cpp @@ -1243,6 +1243,7 @@ Parser::ExprResult Parser::ParseObjCMessageExpression() { } else { ExprResult Res = ParseAssignmentExpression(); if (Res.isInvalid) { + Diag(Tok, diag::err_invalid_receiver_to_message); SkipUntil(tok::identifier); return Res; } diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 8a65b7310e..a6e90b3025 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -322,6 +322,8 @@ DIAG(err_parse_error, ERROR, "parse error") DIAG(err_expected_expression, ERROR, "expected expression") +DIAG(err_invalid_receiver_to_message, ERROR, + "invalid receiver to message expression") DIAG(err_expected_external_declaration, ERROR, "expected external declaration") DIAG(err_expected_ident, ERROR,