Fixup __block codegen in nested block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66091 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/blocks-1.c b/test/CodeGen/blocks-1.c
index 09f009c..725d71f 100644
--- a/test/CodeGen/blocks-1.c
+++ b/test/CodeGen/blocks-1.c
@@ -1,14 +1,34 @@
// RUN: clang %s -emit-llvm -o %t -fblocks -f__block
#include <stdio.h>
+void test1() {
+ __block int a;
+ int b=2;
+ a=1;
+ printf("a is %d, b is %d\n", a, b);
+ ^{ a = 10; printf("a is %d, b is %d\n", a, b); }();
+ printf("a is %d, b is %d\n", a, b);
+ a = 1;
+ printf("a is %d, b is %d\n", a, b);
+}
+
+
+void test2() {
+ __block int a;
+ a=1;
+ printf("a is %d\n", a);
+ ^{
+ ^{
+ a = 10;
+ }();
+ }();
+ printf("a is %d\n", a);
+ a = 1;
+ printf("a is %d\n", a);
+}
+
int main() {
- __block int a;
- int b=2;
- a=1;
- printf("a is %d, b is %d\n", a, b);
- ^{ a = 10; printf("a is %d, b is %d\n", a, b); }();
- printf("a is %d, b is %d\n", a, b);
- a = 1;
- printf("a is %d, b is %d\n", a, b);
- return 0;
+ test1();
+ test2();
+ return 0;
}