summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-31 21:34:11 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-31 21:34:11 +0000
commitdd88dbf9d2b342cf2ce7a9d093033adf95475d46 (patch)
tree50f5cff069903a28a607af72beb2dde62bd3dac7 /clang/test
parent9a58919c8e24503f047068a8bf521d307c817f9d (diff)
downloadbcm5719-llvm-dd88dbf9d2b342cf2ce7a9d093033adf95475d46.tar.gz
bcm5719-llvm-dd88dbf9d2b342cf2ce7a9d093033adf95475d46.zip
Add -Wcustom-atomic-properties which warns if an atomic-by-default property has custom getter or setter.
The rationale is that it is highly likely that the user's getter/setter isn't atomically implemented. Off by default. Addresses rdar://8782645. -Wcustom-atomic-properties and -Wimplicit-atomic-properties are under the -Watomic-properties group. llvm-svn: 124609
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/custom-atomic-property.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/custom-atomic-property.m b/clang/test/SemaObjC/custom-atomic-property.m
new file mode 100644
index 00000000000..cf3d473849f
--- /dev/null
+++ b/clang/test/SemaObjC/custom-atomic-property.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -Wcustom-atomic-properties -verify %s
+
+@interface Foo
+@property (assign) Foo *myProp; // expected-note {{property declared here}} expected-note {{property declared here}}
+@end
+
+@implementation Foo
+ -(Foo*)myProp {return 0;} // expected-warning {{atomic by default property 'myProp' has a user defined setter/getter (property should be marked 'atomic' if this is intended)}}
+ -(void)setMyProp:(Foo*)e {} // expected-warning {{atomic by default property 'myProp' has a user defined setter/getter (property should be marked 'atomic' if this is intended)}}
+@end
OpenPOWER on IntegriCloud