forked from OSchip/llvm-project
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:
parent
b31c49a70d
commit
00c291b012
|
@ -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
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue