objc: err on a property designated both atomic and

nonatomic. // rdar://10260017

llvm-svn: 141580
This commit is contained in:
Fariborz Jahanian 2011-10-10 21:53:24 +00:00
parent fcf8462583
commit 55b4e5c208
2 changed files with 17 additions and 0 deletions

View File

@ -1744,6 +1744,13 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
Attributes &= ~ObjCDeclSpec::DQ_PR_weak;
}
if ((Attributes & ObjCDeclSpec::DQ_PR_atomic) &&
(Attributes & ObjCDeclSpec::DQ_PR_nonatomic)) {
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
<< "atomic" << "nonatomic";
Attributes &= ~ObjCDeclSpec::DQ_PR_atomic;
}
// Warn if user supplied no assignment attribute, property is
// readwrite, and this is an object type.
if (!(Attributes & (ObjCDeclSpec::DQ_PR_assign | ObjCDeclSpec::DQ_PR_copy |

View File

@ -0,0 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://10260017
@interface Foo
@property (nonatomic, assign, atomic) float dummy; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
@property (nonatomic, assign) float d1;
@property (atomic, assign) float d2;
@property (assign) float d3;
@property (atomic, nonatomic, assign) float d4; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
@end