[cfe-commits] r92808 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/property-9.m
Fariborz Jahanian
fjahanian at apple.com
Tue Jan 5 16:18:12 PST 2010
Author: fjahanian
Date: Tue Jan 5 18:18:12 2010
New Revision: 92808
URL: http://llvm.org/viewvc/llvm-project?rev=92808&view=rev
Log:
Do not diagnose method disguised as property setter
for a 'readonly' property. Fixes radar 7427072.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/property-9.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=92808&r1=92807&r2=92808&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Jan 5 18:18:12 2010
@@ -1473,8 +1473,11 @@
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())) {
Modified: cfe/trunk/test/SemaObjC/property-9.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-9.m?rev=92808&r1=92807&r2=92808&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-9.m (original)
+++ cfe/trunk/test/SemaObjC/property-9.m Tue Jan 5 18:18:12 2010
@@ -84,3 +84,15 @@
view.inEyeDropperMode = 1;
}
@end
+
+// radar 7427072
+ at interface MyStyleIntf
+{
+ int _myStyle;
+}
+
+ at property(readonly) int myStyle;
+
+- (float)setMyStyle:(int)style;
+ at end
+
More information about the cfe-commits
mailing list