Do not diagnose method disguised as property setter

for a 'readonly' property. Fixes radar 7427072.

llvm-svn: 92808
This commit is contained in:
Fariborz Jahanian 2010-01-06 00:18:12 +00:00
parent 578865ff3d
commit 1a5f292fbf
2 changed files with 17 additions and 2 deletions

View File

@ -1473,8 +1473,11 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
property->getLocation());
if (SetterMethod) {
if (Context.getCanonicalType(SetterMethod->getResultType())
!= Context.VoidTy)
ObjCPropertyDecl::PropertyAttributeKind CAttr =
property->getPropertyAttributes();
if ((!(CAttr & ObjCPropertyDecl::OBJC_PR_readonly)) &&
Context.getCanonicalType(SetterMethod->getResultType()) !=
Context.VoidTy)
Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
if (SetterMethod->param_size() != 1 ||
((*SetterMethod->param_begin())->getType() != property->getType())) {

View File

@ -84,3 +84,15 @@ typedef signed char BOOL;
view.inEyeDropperMode = 1;
}
@end
// radar 7427072
@interface MyStyleIntf
{
int _myStyle;
}
@property(readonly) int myStyle;
- (float)setMyStyle:(int)style;
@end