From: Fariborz Jahanian Date: Mon, 15 Feb 2010 22:20:11 +0000 (+0000) Subject: Issue a bettter diagnostics for incorrect property setter name. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0097db2848c463a534c18c235c6d3e53f2f1b87;p=clang Issue a bettter diagnostics for incorrect property setter name. (radar 7647953). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96284 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticCommonKinds.td b/include/clang/Basic/DiagnosticCommonKinds.td index 7e14a329dc..66f84dbbba 100644 --- a/include/clang/Basic/DiagnosticCommonKinds.td +++ b/include/clang/Basic/DiagnosticCommonKinds.td @@ -31,6 +31,9 @@ def note_also_found : Note<"also found">; // Parse && Lex def err_expected_colon : Error<"expected ':'">; +def err_expected_colon_after_setter_name : Error< + "method name referenced in property setter attribute " + "must end with ':'">; // Parse && Sema def err_no_declarators : Error<"declaration does not declare anything">; diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 3757ee2f6d..d1c9be233f 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -515,7 +515,8 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl, DS.setSetterName(Tok.getIdentifierInfo()); ConsumeToken(); // consume method name - if (ExpectAndConsume(tok::colon, diag::err_expected_colon, "", + if (ExpectAndConsume(tok::colon, + diag::err_expected_colon_after_setter_name, "", tok::r_paren)) return; } else { diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m index b5f57f305f..064a2090b0 100644 --- a/test/Parser/objc-property-syntax.m +++ b/test/Parser/objc-property-syntax.m @@ -5,8 +5,10 @@ }; @property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}} @property unsigned char bufferedUTFBytes:1; // expected-error {{property name cannot be a bitfield}} +@property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}} @end @implementation MyClass +@dynamic ab_defaultToolbarItems; @end