xref: /aosp_15_r20/external/clang/test/Rewriter/rewrite-byref-in-nested-blocks.mm (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
2*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp
3*67e74705SXin Li// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
4*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"SEL=void*" -U__declspec  -D"__declspec(X)=" %t-modern-rw.cpp
5*67e74705SXin Li// radar 7692350
6*67e74705SXin Li
7*67e74705SXin Li// rdar://11375908
8*67e74705SXin Litypedef unsigned long size_t;
9*67e74705SXin Li
10*67e74705SXin Livoid f(void (^block)(void));
11*67e74705SXin Li
12*67e74705SXin Li@interface X {
13*67e74705SXin Li        int y;
14*67e74705SXin Li}
15*67e74705SXin Li- (void)foo;
16*67e74705SXin Li@end
17*67e74705SXin Li
18*67e74705SXin Li@implementation X
19*67e74705SXin Li- (void)foo {
20*67e74705SXin Li        __block int kerfluffle;
21*67e74705SXin Li        // radar 7692183
22*67e74705SXin Li        __block int x;
23*67e74705SXin Li        f(^{
24*67e74705SXin Li                f(^{
25*67e74705SXin Li                                y = 42;
26*67e74705SXin Li                            kerfluffle = 1;
27*67e74705SXin Li			    x = 2;
28*67e74705SXin Li                });
29*67e74705SXin Li        });
30*67e74705SXin Li}
31*67e74705SXin Li@end
32