annotate clang/test/Rewriter/rewrite-nested-blocks.mm @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // 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
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
anatofuz
parents:
diff changeset
5 // radar 7682149
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 typedef unsigned long size_t;
anatofuz
parents:
diff changeset
9 void f(void (^block)(void));
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 @interface X {
anatofuz
parents:
diff changeset
12 int y;
anatofuz
parents:
diff changeset
13 }
anatofuz
parents:
diff changeset
14 - (void)foo;
anatofuz
parents:
diff changeset
15 @end
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 @implementation X
anatofuz
parents:
diff changeset
18 - (void)foo {
anatofuz
parents:
diff changeset
19 f(^{
anatofuz
parents:
diff changeset
20 f(^{
anatofuz
parents:
diff changeset
21 f(^{
anatofuz
parents:
diff changeset
22 y=42;
anatofuz
parents:
diff changeset
23 });
anatofuz
parents:
diff changeset
24 });
anatofuz
parents:
diff changeset
25 });
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 @end
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 struct S {
anatofuz
parents:
diff changeset
31 int y;
anatofuz
parents:
diff changeset
32 };
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 void foo () {
anatofuz
parents:
diff changeset
35 struct S *SELF;
anatofuz
parents:
diff changeset
36 f(^{
anatofuz
parents:
diff changeset
37 f(^{
anatofuz
parents:
diff changeset
38 SELF->y = 42;
anatofuz
parents:
diff changeset
39 });
anatofuz
parents:
diff changeset
40 });
anatofuz
parents:
diff changeset
41 }
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 // radar 7692419
anatofuz
parents:
diff changeset
44 @interface Bar
anatofuz
parents:
diff changeset
45 @end
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 void f(Bar *);
anatofuz
parents:
diff changeset
48 void q(void (^block)(void));
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 void x() {
anatofuz
parents:
diff changeset
51 void (^myblock)(Bar *b) = ^(Bar *b) {
anatofuz
parents:
diff changeset
52 q(^{
anatofuz
parents:
diff changeset
53 f(b);
anatofuz
parents:
diff changeset
54 });
anatofuz
parents:
diff changeset
55 };
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 Bar *b = (Bar *)42;
anatofuz
parents:
diff changeset
58 myblock(b);
anatofuz
parents:
diff changeset
59 }