From 1a5f292fbfcae4b6ddd6ba3fb3b03d068845c70e Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 6 Jan 2010 00:18:12 +0000 Subject: Do not diagnose method disguised as property setter for a 'readonly' property. Fixes radar 7427072. llvm-svn: 92808 --- clang/lib/Sema/SemaDeclObjC.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index fb2cc712dce..115a4333031 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -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())) { -- cgit v1.2.3