xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-modern-captured-nested-bvar.mm (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -E %s -o %t.mm
2f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o - | FileCheck %s
3f4a2713aSLionel Sambuc// rdar://9006279
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambucvoid q(void (^p)(void)) {
6f4a2713aSLionel Sambuc    p();
7f4a2713aSLionel Sambuc}
8f4a2713aSLionel Sambuc
9f4a2713aSLionel Sambucvoid f() {
10f4a2713aSLionel Sambuc    __block char BYREF_VAR_CHECK = 'a';
11f4a2713aSLionel Sambuc    __block char d = 'd';
12f4a2713aSLionel Sambuc    q(^{
13f4a2713aSLionel Sambuc        q(^{
14f4a2713aSLionel Sambuc            __block char e = 'e';
15f4a2713aSLionel Sambuc            char l = 'l';
16f4a2713aSLionel Sambuc            BYREF_VAR_CHECK = 'b';
17f4a2713aSLionel Sambuc            d = 'd';
18f4a2713aSLionel Sambuc            q(^{
19f4a2713aSLionel Sambuc                 e = '1';
20f4a2713aSLionel Sambuc                 BYREF_VAR_CHECK = '2';
21f4a2713aSLionel Sambuc                 d = '3';
22f4a2713aSLionel Sambuc               }
23f4a2713aSLionel Sambuc             );
24f4a2713aSLionel Sambuc        });
25f4a2713aSLionel Sambuc    });
26f4a2713aSLionel Sambuc}
27f4a2713aSLionel Sambuc
28f4a2713aSLionel Sambucint main() {
29f4a2713aSLionel Sambuc    f();
30f4a2713aSLionel Sambuc    return 0;
31f4a2713aSLionel Sambuc}
32f4a2713aSLionel Sambuc
33f4a2713aSLionel Sambuc// CHECK 2: (__Block_byref_BYREF_VAR_CHECK_0 *)BYREF_VAR_CHECK
34f4a2713aSLionel Sambuc// CHECK: {(void*)0,(__Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, 0, sizeof(__Block_byref_BYREF_VAR_CHECK_0), 'a'}
35*0a6a1f1dSLionel Sambuc// CHECK: __Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, (__Block_byref_d_1 *)&d, 570425344)));
36