| ... | @@ -14286,6 +14286,38 @@ fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -14286,6 +14286,38 @@ fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 14286 | const src = inst_data.src(); | 14286 | const src = inst_data.src(); |
| 14287 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 14287 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 14288 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); | 14288 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| | 14289 | switch (operand_ty.zigTypeTag()) { |
| | 14290 | .Fn, |
| | 14291 | .NoReturn, |
| | 14292 | .Undefined, |
| | 14293 | .Null, |
| | 14294 | .BoundFn, |
| | 14295 | .Opaque, |
| | 14296 | => return sema.fail(block, operand_src, "no size available for type '{}'", .{operand_ty.fmt(sema.mod)}), |
| | 14297 | |
| | 14298 | .Type, |
| | 14299 | .EnumLiteral, |
| | 14300 | .ComptimeFloat, |
| | 14301 | .ComptimeInt, |
| | 14302 | .Void, |
| | 14303 | => return sema.addIntUnsigned(Type.comptime_int, 0), |
| | 14304 | |
| | 14305 | .Bool, |
| | 14306 | .Int, |
| | 14307 | .Float, |
| | 14308 | .Pointer, |
| | 14309 | .Array, |
| | 14310 | .Struct, |
| | 14311 | .Optional, |
| | 14312 | .ErrorUnion, |
| | 14313 | .ErrorSet, |
| | 14314 | .Enum, |
| | 14315 | .Union, |
| | 14316 | .Vector, |
| | 14317 | .Frame, |
| | 14318 | .AnyFrame, |
| | 14319 | => {}, |
| | 14320 | } |
| 14289 | const target = sema.mod.getTarget(); | 14321 | const target = sema.mod.getTarget(); |
| 14290 | const bit_size = try operand_ty.bitSizeAdvanced(target, sema.kit(block, src)); | 14322 | const bit_size = try operand_ty.bitSizeAdvanced(target, sema.kit(block, src)); |
| 14291 | return sema.addIntUnsigned(Type.comptime_int, bit_size); | 14323 | return sema.addIntUnsigned(Type.comptime_int, bit_size); |