1//
2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3// See https://llvm.org/LICENSE.txt for license information.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6//
7// nullblockisa.m
8// testObjects
9//
10// Created by Blaine Garst on 9/24/08.
11//
12// CONFIG rdar://6244520
13
14
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <Block_private.h>
19
20
21void check(void (^b)(void)) {
22 struct _custom {
23 struct Block_layout layout;
24 struct Block_byref *innerp;
25 } *custom = (struct _custom *)(void *)(b);
26 //printf("block is at %p, size is %lx, inner is %p\n", (void *)b, Block_size(b), innerp);
27 if (custom->innerp->isa != (void *)NULL) {
28 printf(format: "not a NULL __block isa\n");
29 exit(status: 1);
30 }
31 return;
32}
33
34int main(int argc, char *argv[]) {
35
36 __block int i;
37
38 check(b: ^{ printf(format: "%d\n", ++i); });
39 printf(format: "%s: success\n", argv[0]);
40 return 0;
41}
42
43

source code of compiler-rt/test/BlocksRuntime/nullblockisa.c