summaryrefslogtreecommitdiffstats
path: root/test/CodeGenObjC/synchronized.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenObjC/synchronized.m')
-rw-r--r--test/CodeGenObjC/synchronized.m41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m
new file mode 100644
index 0000000..b398ca6
--- /dev/null
+++ b/test/CodeGenObjC/synchronized.m
@@ -0,0 +1,41 @@
+// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin9 -o %t %s -O2 &&
+// RUN: grep 'ret i32' %t | count 1 &&
+// RUN: grep 'ret i32 1' %t | count 1
+
+@interface MyClass
+{
+}
+- (void)method;
+@end
+
+@implementation MyClass
+
+- (void)method
+{
+ @synchronized(self)
+ {
+ }
+}
+
+@end
+
+void foo(id a) {
+ @synchronized(a) {
+ return;
+ }
+}
+
+int f0(id a) {
+ int x = 0;
+ @synchronized((x++, a)) {
+ }
+ return x; // ret i32 1
+}
+
+void f1(id a) {
+ // The trick here is that the return shouldn't go through clean up,
+ // but there isn't a simple way to check this property.
+ @synchronized(({ return; }), a) {
+ return;
+ }
+}
OpenPOWER on IntegriCloud