diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-02-22 17:03:24 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-02-22 17:09:20 -0800 |
| commit | eb3c7f570601a6e00cbf03f0a026b3493887a534 (patch) | |
| tree | e621eb6aa4ab49bb72018d33c373b258f55922df /src/codegen/c/Type.zig | |
| parent | c0c911bfa78ea2968cd110ad64a4ba0d70ca93e5 (diff) | |
| download | zig-eb3c7f570601a6e00cbf03f0a026b3493887a534.tar.gz zig-eb3c7f570601a6e00cbf03f0a026b3493887a534.zip | |
zig build fmt
Diffstat (limited to 'src/codegen/c/Type.zig')
| -rw-r--r-- | src/codegen/c/Type.zig | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/src/codegen/c/Type.zig b/src/codegen/c/Type.zig index 54f012e8ef..ec1bf40e0c 100644 --- a/src/codegen/c/Type.zig +++ b/src/codegen/c/Type.zig @@ -758,12 +758,12 @@ pub const Info = union(enum) { fn tag(pointer_info: Pointer) Pool.Tag { return @enumFromInt(@intFromEnum(Pool.Tag.pointer) + @as(u2, @bitCast(packed struct(u2) { - @"const": bool, - @"volatile": bool, - }{ - .@"const" = pointer_info.@"const", - .@"volatile" = pointer_info.@"volatile", - }))); + @"const": bool, + @"volatile": bool, + }{ + .@"const" = pointer_info.@"const", + .@"volatile" = pointer_info.@"volatile", + }))); } }; @@ -887,24 +887,24 @@ pub const Info = union(enum) { pool_adapter.eql(lhs_vector_info.elem_ctype, rhs_info.vector.elem_ctype), .fwd_decl => |lhs_fwd_decl_info| lhs_fwd_decl_info.tag == rhs_info.fwd_decl.tag and switch (lhs_fwd_decl_info.name) { - .anon => |lhs_anon| rhs_info.fwd_decl.name == .anon and lhs_anon.eqlAdapted( - lhs_pool, - rhs_info.fwd_decl.name.anon, - rhs_pool, - pool_adapter, - ), - .index => |lhs_index| rhs_info.fwd_decl.name == .index and - lhs_index == rhs_info.fwd_decl.name.index, - }, + .anon => |lhs_anon| rhs_info.fwd_decl.name == .anon and lhs_anon.eqlAdapted( + lhs_pool, + rhs_info.fwd_decl.name.anon, + rhs_pool, + pool_adapter, + ), + .index => |lhs_index| rhs_info.fwd_decl.name == .index and + lhs_index == rhs_info.fwd_decl.name.index, + }, .aggregate => |lhs_aggregate_info| lhs_aggregate_info.tag == rhs_info.aggregate.tag and lhs_aggregate_info.@"packed" == rhs_info.aggregate.@"packed" and switch (lhs_aggregate_info.name) { - .anon => |lhs_anon| rhs_info.aggregate.name == .anon and - lhs_anon.index == rhs_info.aggregate.name.anon.index and - lhs_anon.id == rhs_info.aggregate.name.anon.id, - .fwd_decl => |lhs_fwd_decl| rhs_info.aggregate.name == .fwd_decl and - pool_adapter.eql(lhs_fwd_decl, rhs_info.aggregate.name.fwd_decl), - } and lhs_aggregate_info.fields.eqlAdapted( + .anon => |lhs_anon| rhs_info.aggregate.name == .anon and + lhs_anon.index == rhs_info.aggregate.name.anon.index and + lhs_anon.id == rhs_info.aggregate.name.anon.id, + .fwd_decl => |lhs_fwd_decl| rhs_info.aggregate.name == .fwd_decl and + pool_adapter.eql(lhs_fwd_decl, rhs_info.aggregate.name.fwd_decl), + } and lhs_aggregate_info.fields.eqlAdapted( lhs_pool, rhs_info.aggregate.fields, rhs_pool, @@ -913,13 +913,12 @@ pub const Info = union(enum) { .function => |lhs_function_info| lhs_function_info.param_ctypes.len == rhs_info.function.param_ctypes.len and pool_adapter.eql(lhs_function_info.return_ctype, rhs_info.function.return_ctype) and - for (0..lhs_function_info.param_ctypes.len) |param_index| - { - if (!pool_adapter.eql( - lhs_function_info.param_ctypes.at(param_index, lhs_pool), - rhs_info.function.param_ctypes.at(param_index, rhs_pool), - )) break false; - } else true, + for (0..lhs_function_info.param_ctypes.len) |param_index| { + if (!pool_adapter.eql( + lhs_function_info.param_ctypes.at(param_index, lhs_pool), + rhs_info.function.param_ctypes.at(param_index, rhs_pool), + )) break false; + } else true, }; } }; @@ -2301,13 +2300,13 @@ pub const Pool = struct { const return_type = Type.fromInterned(func_info.return_type); const return_ctype: CType = if (!ip.isNoReturn(func_info.return_type)) try pool.fromType( - allocator, - scratch, - return_type, - pt, - mod, - kind.asParameter(), - ) else .void; + allocator, + scratch, + return_type, + pt, + mod, + kind.asParameter(), + ) else .void; for (0..func_info.param_types.len) |param_index| { const param_type = Type.fromInterned( func_info.param_types.get(ip)[param_index], |
