Issue a bettter diagnostics for incorrect property setter name.

(radar 7647953).

llvm-svn: 96284
This commit is contained in:
Fariborz Jahanian 2010-02-15 22:20:11 +00:00
parent 3e0c140c50
commit 8efe0ec899
3 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,9 @@ def note_also_found : Note<"also found">;
// Parse && Lex // Parse && Lex
def err_expected_colon : Error<"expected ':'">; 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 // Parse && Sema
def err_no_declarators : Error<"declaration does not declare anything">; def err_no_declarators : Error<"declaration does not declare anything">;

View File

@ -515,7 +515,8 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
DS.setSetterName(Tok.getIdentifierInfo()); DS.setSetterName(Tok.getIdentifierInfo());
ConsumeToken(); // consume method name 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)) tok::r_paren))
return; return;
} else { } else {

View File

@ -5,8 +5,10 @@
}; };
@property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}} @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 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 @end
@implementation MyClass @implementation MyClass
@dynamic ab_defaultToolbarItems;
@end @end