summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-24 01:43:46 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-24 01:43:46 +0000
commit94ceb615746d237f4df84f757adc73b9320c94ae (patch)
tree382d86cf4117aa1db070b876a2b3ee1090a9982c /clang/test
parentd6e190d899720736cb56d2a18596192cf8d15ad6 (diff)
downloadbcm5719-llvm-94ceb615746d237f4df84f757adc73b9320c94ae.tar.gz
bcm5719-llvm-94ceb615746d237f4df84f757adc73b9320c94ae.zip
Fix two @synchronized bugs found by inspection: the expression to sychronize on should only be evaluated once, and it is evaluated outside the cleanup scope.
Also, lift SyncEnter and SyncExit up in nervous anticipation of x86-64 zero cost EH. llvm-svn: 65362
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenObjC/synchronized.m19
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/test/CodeGenObjC/synchronized.m b/clang/test/CodeGenObjC/synchronized.m
index c74a83edbe3..3e59449e0bb 100644
--- a/clang/test/CodeGenObjC/synchronized.m
+++ b/clang/test/CodeGenObjC/synchronized.m
@@ -1,5 +1,6 @@
-// RUN: clang -emit-llvm -triple=i686-apple-darwin8 -o %t %s
-// RUNX: clang -emit-llvm -o %t %s
+// RUN: clang -emit-llvm -triple=i686-apple-darwin8 -o %t %s -O2 &&
+// RUN: grep 'ret i32' %t | count 1 &&
+// RUN: grep 'ret i32 1' %t | count 1
#include <stdio.h>
@@ -28,5 +29,17 @@ void foo(id a) {
}
}
+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