xref: /llvm-project/clang/test/Rewriter/blockcast3.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -E %s -o %t.mm
2// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %t.mm -o %t-rw.cpp
3// RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s
4// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o %t-modern-rw.cpp
5// RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-modern-rw.cpp %s
6
7typedef struct {
8	int a;
9	int b;
10} mystruct;
11
12void g(int (^block)(mystruct s)) {
13	mystruct x;
14	int v = block(x);
15}
16
17void f(const void **arg) {
18	__block const void **q = arg;
19	g(^(mystruct s){
20		*q++ = (void*)s.a;
21		return 314;
22		});
23}
24
25// CHECK-LP: (__Block_byref_q_0 *)&q
26