2019-06-06 05:11:06 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
|
2010-09-08 07:26:17 +08:00
|
|
|
// rdar: // 8390455
|
|
|
|
|
2019-06-06 05:11:06 +08:00
|
|
|
// CHECK: @ArrayRecurs = internal global
|
|
|
|
// CHECK: @FUNC.ArrayRecurs = internal global
|
|
|
|
// CHECK: @FUNC.ArrayRecurs.1 = internal global
|
|
|
|
// CHECK: @FUNC1.ArrayRecurs = internal global
|
|
|
|
|
2010-09-08 07:26:17 +08:00
|
|
|
@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;
|
|
|
|
};
|
|
|
|
|
2015-08-20 04:49:38 +08:00
|
|
|
extern NSArray *address;
|
|
|
|
extern unsigned long level;
|
|
|
|
|
2010-09-08 07:26:17 +08:00
|
|
|
void FUNC()
|
|
|
|
{
|
2015-08-20 04:49:38 +08:00
|
|
|
ArrayRecurs(address, level);
|
|
|
|
|
2010-09-08 07:26:17 +08:00
|
|
|
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;
|
|
|
|
};
|
2015-08-20 04:49:38 +08:00
|
|
|
ArrayRecurs(address, level);
|
2010-09-08 07:26:17 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2015-08-20 04:49:38 +08:00
|
|
|
ArrayRecurs(address, level);
|
2010-09-08 07:26:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-23 05:32:06 +08:00
|
|
|
void FUNC2() {
|
|
|
|
static void (^const block1)(int) = ^(int a){
|
|
|
|
if (a--)
|
|
|
|
block1(a);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @FUNC2(
|
2017-09-23 05:32:06 +08:00
|
|
|
// CHECK: define internal void @_block_invoke{{.*}}(
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK: call void %{{.*}}(i8* noundef bitcast ({ i8**, i32, i32, i8*, %struct.__block_descriptor* }* @__block_literal_global{{.*}} to i8*), i32 noundef %{{.*}})
|
2017-09-23 05:32:06 +08:00
|
|
|
|
2010-09-08 07:26:17 +08:00
|
|
|
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;
|
|
|
|
};
|
2015-08-20 04:49:38 +08:00
|
|
|
ArrayRecurs(address, level);
|
2010-09-08 07:26:17 +08:00
|
|
|
}
|