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 {...@@ -37,9 +37,15 @@ pub const QualType = extern struct {
37};37};
3838
39pub const APValueLValueBase = extern struct {39pub const APValueLValueBase = extern struct {
40 Ptr: ?*anyopaque,40 Ptr: ?*anyopaque align(@alignOf(u64)),
41 CallIndex: c_uint,41 State: extern union {
42 Version: c_uint,42 Local: extern struct {
43 CallIndex: c_uint,
44 Version: c_uint,
45 },
46 TypeInfoType: ?*anyopaque,
47 DynamicAllocType: ?*anyopaque,
48 },
4349
44 pub const dyn_cast_Expr = ZigClangAPValueLValueBase_dyn_cast_Expr;50 pub const dyn_cast_Expr = ZigClangAPValueLValueBase_dyn_cast_Expr;
45 extern fn ZigClangAPValueLValueBase_dyn_cast_Expr(APValueLValueBase) ?*const Expr;51 extern fn ZigClangAPValueLValueBase_dyn_cast_Expr(APValueLValueBase) ?*const Expr;
src/zig_clang.h+10-4
...@@ -43,10 +43,16 @@ struct ZigClangQualType {...@@ -43,10 +43,16 @@ struct ZigClangQualType {
43 void *ptr;43 void *ptr;
44};44};
4545
46struct ZigClangAPValueLValueBase {46struct alignas(uint64_t) ZigClangAPValueLValueBase {
47 void *Ptr;47 void* Ptr;
48 unsigned CallIndex;48 union {
49 unsigned Version;49 struct {
50 unsigned CallIndex;
51 unsigned Version;
52 } Local;
53 void* TypeInfoType;
54 void* DynamicAllocType;
55 };
50};56};
5157
52enum ZigClangAPValueKind {58enum ZigClangAPValueKind {