| ... | ... | @@ -498,9 +498,11 @@ pub const DeclState = struct { |
| 498 | 498 | .ErrorUnion => { |
| 499 | 499 | const error_ty = ty.errorUnionSet(); |
| 500 | 500 | const payload_ty = ty.errorUnionPayload(); |
| 501 | const payload_align = payload_ty.abiAlignment(target); |
| 502 | const error_align = Type.anyerror.abiAlignment(target); |
| 501 | 503 | const abi_size = ty.abiSize(target); |
| 502 | | const abi_align = ty.abiAlignment(target); |
| 503 | | const payload_off = mem.alignForwardGeneric(u64, error_ty.abiSize(target), abi_align); |
| 504 | const payload_off = if (error_align >= payload_align) Type.anyerror.abiSize(target) else 0; |
| 505 | const error_off = if (error_align >= payload_align) 0 else payload_ty.abiSize(target); |
| 504 | 506 | |
| 505 | 507 | // DW.AT.structure_type |
| 506 | 508 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| ... | ... | @@ -534,7 +536,7 @@ pub const DeclState = struct { |
| 534 | 536 | try dbg_info_buffer.resize(index + 4); |
| 535 | 537 | try self.addTypeReloc(atom, error_ty, @intCast(u32, index), null); |
| 536 | 538 | // DW.AT.data_member_location, DW.FORM.sdata |
| 537 | | try dbg_info_buffer.append(0); |
| 539 | try leb128.writeULEB128(dbg_info_buffer.writer(), error_off); |
| 538 | 540 | |
| 539 | 541 | // DW.AT.structure_type delimit children |
| 540 | 542 | try dbg_info_buffer.append(0); |
| ... | ... | @@ -2293,7 +2295,7 @@ fn addDbgInfoErrorSet( |
| 2293 | 2295 | // DW.AT.enumeration_type |
| 2294 | 2296 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.enum_type)); |
| 2295 | 2297 | // DW.AT.byte_size, DW.FORM.sdata |
| 2296 | | const abi_size = ty.abiSize(target); |
| 2298 | const abi_size = Type.anyerror.abiSize(target); |
| 2297 | 2299 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| 2298 | 2300 | // DW.AT.name, DW.FORM.string |
| 2299 | 2301 | const name = try ty.nameAllocArena(arena, module); |