and fix a missing diagnostics on assigning to a read-only
property. Fixes radar
7766184.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99230
91177308-0d34-0410-b5e6-
96231b3b80d8
ObjCPropertyDecl *PDecl =
ObjCPropertyDecl::Create(Context, DC, FD.D.getIdentifierLoc(),
PropertyId, AtLoc, T);
+ if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
+ PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly);
+ if (Attributes & ObjCDeclSpec::DQ_PR_readwrite)
+ PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite);
+
DC->addDecl(PDecl);
// We need to look in the @interface to see if the @property was
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 7766184
+
+@interface Foo @end
+
+@interface Foo ()
+ @property (readonly) int bar;
+@end
+
+void FUNC () {
+ Foo *foo;
+ foo.bar = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
+}
+
+