llvm-project
41 строка · 938.0 Байт
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)) {
22struct _custom {
23struct Block_layout layout;
24struct 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);
27if (custom->innerp->isa != (void *)NULL) {
28printf("not a NULL __block isa\n");
29exit(1);
30}
31return;
32}
33
34int main(int argc, char *argv[]) {
35
36__block int i;
37
38check(^{ printf("%d\n", ++i); });
39printf("%s: success\n", argv[0]);
40return 0;
41}
42
43