From 8efe0ec8992881b9d727b9214fa094fd48c91f0d Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 15 Feb 2010 22:20:11 +0000 Subject: [PATCH] Issue a bettter diagnostics for incorrect property setter name. (radar 7647953). llvm-svn: 96284 --- clang/include/clang/Basic/DiagnosticCommonKinds.td | 3 +++ clang/lib/Parse/ParseObjc.cpp | 3 ++- clang/test/Parser/objc-property-syntax.m | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index 7e14a329dcab..66f84dbbbabe 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/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/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 3757ee2f6d23..d1c9be233fe0 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/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/clang/test/Parser/objc-property-syntax.m b/clang/test/Parser/objc-property-syntax.m index b5f57f305f39..064a2090b005 100644 --- a/clang/test/Parser/objc-property-syntax.m +++ b/clang/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