diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-17 22:28:16 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-12-17 22:28:16 +0000 |
commit | dd4430e596fac34e9ce44228a249f71e73effd4a (patch) | |
tree | 2bce62060f4959038ea09ff5d002e341922cbe6e /lib/Sema/SemaObjCProperty.cpp | |
parent | 74cae0c64d3cf85bcfbc9e7febac83a580804d57 (diff) |
Warn when synthesizing a property which is
implicitly atomic under -Wimplicit-atomic-properties
flag. // rdar://8774580
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index a1664d558e..65a447e2a1 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -299,6 +299,8 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic) PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic); + else if (Attributes & ObjCDeclSpec::DQ_PR_atomic) + PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_atomic); PDecl->setPropertyAttributesAsWritten(PDecl->getPropertyAttributes()); @@ -349,6 +351,16 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName(); return 0; } + unsigned PIkind = property->getPropertyAttributesAsWritten(); + if ((PIkind & (ObjCPropertyDecl::OBJC_PR_atomic | + ObjCPropertyDecl::OBJC_PR_nonatomic) ) == 0) { + if (AtLoc.isValid()) + Diag(AtLoc, diag::warn_implicit_atomic_property); + else + Diag(IC->getLocation(), diag::warn_auto_implicit_atomic_property); + Diag(property->getLocation(), diag::note_property_declare); + } + if (const ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) { if (!CD->IsClassExtension()) { |