local-static-block.m
2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
// rdar: // 8390455
// CHECK: @ArrayRecurs = internal global
// CHECK: @FUNC.ArrayRecurs = internal global
// CHECK: @FUNC.ArrayRecurs.1 = internal global
// CHECK: @FUNC1.ArrayRecurs = internal global
@class NSArray;
static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
for(id rawAddress in addresses)
{
NSArray *separatedAddresses = ((NSArray*)0);
separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
}
return (NSArray *)0;
};
extern NSArray *address;
extern unsigned long level;
void FUNC()
{
ArrayRecurs(address, level);
static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
for(id rawAddress in addresses)
{
NSArray *separatedAddresses = ((NSArray*)0);
separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
}
return (NSArray *)0;
};
ArrayRecurs(address, level);
if (ArrayRecurs) {
static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
for(id rawAddress in addresses)
{
NSArray *separatedAddresses = ((NSArray*)0);
separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
}
return (NSArray *)0;
};
ArrayRecurs(address, level);
}
}
void FUNC2() {
static void (^const block1)(int) = ^(int a){
if (a--)
block1(a);
};
}
// CHECK-LABEL: define void @FUNC2(
// CHECK: define internal void @_block_invoke{{.*}}(
// CHECK: call void %{{.*}}(i8* bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{.*}} to i8*), i32 %{{.*}})
void FUNC1()
{
static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
for(id rawAddress in addresses)
{
NSArray *separatedAddresses = ((NSArray*)0);
separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
}
return (NSArray *)0;
};
ArrayRecurs(address, level);
}