diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 22:40:11 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 22:40:11 +0000 |
| commit | df58603c2600e2ce2aeacc16d37d287524941e89 (patch) | |
| tree | 5f1f6ec9cb67815b5d234b47949ebde41f482e3f /clang/lib/Sema/SemaObjCProperty.cpp | |
| parent | adb58e32cc2afcced85afb7d7b3938310683099f (diff) | |
| download | bcm5719-llvm-df58603c2600e2ce2aeacc16d37d287524941e89.tar.gz bcm5719-llvm-df58603c2600e2ce2aeacc16d37d287524941e89.zip | |
Recognize __attribute__((NSObject)) directly applied
on retain properties. (radar 7809468).
llvm-svn: 99951
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 4dc734de8ae..f815068fac2 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -44,9 +44,6 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, Diag(AtLoc, diag::error_reference_property); return DeclPtrTy(); } - // Validate the attributes on the @property. - CheckObjCPropertyAttributes(T, AtLoc, Attributes); - // Proceed with constructing the ObjCPropertDecls. ObjCContainerDecl *ClassDecl = cast<ObjCContainerDecl>(ClassCategory.getAs<Decl>()); @@ -60,10 +57,13 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, isOverridingProperty, T, MethodImplKind); - return DeclPtrTy::make(CreatePropertyDecl(S, ClassDecl, AtLoc, FD, + DeclPtrTy Res = DeclPtrTy::make(CreatePropertyDecl(S, ClassDecl, AtLoc, FD, GetterSel, SetterSel, isAssign, isReadWrite, Attributes, T, MethodImplKind)); + // Validate the attributes on the @property. + CheckObjCPropertyAttributes(Res, AtLoc, Attributes); + return Res; } Sema::DeclPtrTy @@ -982,10 +982,13 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, AddInstanceMethodToGlobalPool(SetterMethod); } -void Sema::CheckObjCPropertyAttributes(QualType PropertyTy, +void Sema::CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy, SourceLocation Loc, unsigned &Attributes) { // FIXME: Improve the reported location. + Decl *PDecl = PropertyPtrTy.getAs<Decl>(); + ObjCPropertyDecl *PropertyDecl = dyn_cast_or_null<ObjCPropertyDecl>(PDecl); + QualType PropertyTy = PropertyDecl->getType(); // readonly and readwrite/assign/retain/copy conflict. if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) && @@ -1010,7 +1013,8 @@ void Sema::CheckObjCPropertyAttributes(QualType PropertyTy, if ((Attributes & (ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain)) && !PropertyTy->isObjCObjectPointerType() && !PropertyTy->isBlockPointerType() && - !Context.isObjCNSObjectType(PropertyTy)) { + !Context.isObjCNSObjectType(PropertyTy) && + !PropertyDecl->getAttr<ObjCNSObjectAttr>()) { Diag(Loc, diag::err_objc_property_requires_object) << (Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain"); Attributes &= ~(ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain); |

