authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-31 15:26:15+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-31 20:18:57+02:00
logab99dd9c5d22a3d927453081654b1f75b2521b48
treeb865c84391aa83a9985e5d1678ac015e785345d8
parent7fdd60df1c40bc36a8e0b35be3e35f81dd97fbce

zig_clang: fix ZigClangAPValueLValueBase struct layout to match Clang 21

Fixes the compiler build for various targets, especially 32-bit.

2 files changed, 19 insertions(+), 7 deletions(-)

src/clang.zig+9-3
......@@ -37,9 +37,15 @@ pub const QualType = extern struct {
3737};
3838
3939pub const APValueLValueBase = extern struct {
40 Ptr: ?*anyopaque,
41 CallIndex: c_uint,
42 Version: c_uint,
40 Ptr: ?*anyopaque align(@alignOf(u64)),
41 State: extern union {
42 Local: extern struct {
43 CallIndex: c_uint,
44 Version: c_uint,
45 },
46 TypeInfoType: ?*anyopaque,
47 DynamicAllocType: ?*anyopaque,
48 },
4349
4450 pub const dyn_cast_Expr = ZigClangAPValueLValueBase_dyn_cast_Expr;
4551 extern fn ZigClangAPValueLValueBase_dyn_cast_Expr(APValueLValueBase) ?*const Expr;
src/zig_clang.h+10-4
......@@ -43,10 +43,16 @@ struct ZigClangQualType {
4343 void *ptr;
4444};
4545
46struct ZigClangAPValueLValueBase {
47 void *Ptr;
48 unsigned CallIndex;
49 unsigned Version;
46struct alignas(uint64_t) ZigClangAPValueLValueBase {
47 void* Ptr;
48 union {
49 struct {
50 unsigned CallIndex;
51 unsigned Version;
52 } Local;
53 void* TypeInfoType;
54 void* DynamicAllocType;
55 };
5056};
5157
5258enum ZigClangAPValueKind {