Set the relevent attributes declared in class extension

and fix a missing diagnostics on assigning to a read-only
property. Fixes radar 7766184.

llvm-svn: 99230
This commit is contained in:
Fariborz Jahanian 2010-03-22 23:25:52 +00:00
parent b31c49a70d
commit 00c291b012
2 changed files with 20 additions and 0 deletions

View File

@ -93,6 +93,11 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
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

View File

@ -0,0 +1,15 @@
// 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}}
}