Respect isReadOnly when generating synthesized method decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55364
91177308-0d34-0410-b5e6-
96231b3b80d8
void setPropertyAttributes(PropertyAttributeKind PRVal) {
PropertyAttributes |= PRVal;
}
+
+ bool isReadOnly() const {
+ return (PropertyAttributes & OBJC_PR_readonly);
+ }
Selector getGetterName() const { return GetterName; }
void setGetterName(Selector Sel) { GetterName = Sel; }
}
property->setGetterMethodDecl(GetterDecl);
+ // Skip setter if property is read-only.
+ if (property->isReadOnly())
+ return;
+
// Find the default setter and if one not found, add one.
ObjCMethodDecl *SetterDecl = getInstanceMethod(property->getSetterName());
if (!SetterDecl) {
@property(readonly) ConstData *p_base; // expected-warning {{property type 'ConstData *' does not match property type inherited from 'Data'}}
@end
+void foo(Base *b, id x) {
+ [ b setRef: x ]; // expected-warning {{method '-setRef:' not found}}
+}