llvm-project/clang/test/CodeGenObjC/block-layout-section.m
Damian Malarczyk ba294608be
Move the ObjC blocks layout bitmap to the cstring section (#182398)
This is a follow-up to https://github.com/llvm/llvm-project/pull/174705

There's one additional place in the ObjC code gen logic to make sure the
ObjC blocks layout is generated in the regular cstring section.
2026-02-23 10:44:09 -08:00

25 lines
620 B
Objective-C

// REQUIRES: target={{.*}}-{{darwin|macos}}{{.*}}
// RUN: %clang_cc1 -fblocks -triple arm64-apple-darwin -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -fblocks -x objective-c++ -triple arm64-apple-darwin -emit-llvm -o - %s | FileCheck %s
typedef struct
{
int a;
} BlockState;
typedef void(^InBlock)(int);
void sink(InBlock);
int doMagic(void)
{
__block BlockState state;
sink(^(int in) {
state.a += in;
});
return state.a;
}
// block layout in the regular c-string section
// CHECK: @OBJC_LAYOUT_BITMAP_{{.*}} = private unnamed_addr constant {{.*}} section "__TEXT,__cstring,cstring_literals"