Author: fjahanian
Date: Mon Oct 10 16:53:24 2011
New Revision: 141580

URL: http://llvm.org/viewvc/llvm-project?rev=141580&view=rev
Log:
objc: err on a property designated both atomic and
nonatomic. // rdar://10260017

Added:
    cfe/trunk/test/SemaObjC/conflict-atomic-property.m
Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=141580&r1=141579&r2=141580&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Oct 10 16:53:24 2011
@@ -1744,6 +1744,13 @@
       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 |

Added: cfe/trunk/test/SemaObjC/conflict-atomic-property.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/conflict-atomic-property.m?rev=141580&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/conflict-atomic-property.m (added)
+++ cfe/trunk/test/SemaObjC/conflict-atomic-property.m Mon Oct 10 16:53:24 2011
@@ -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


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to