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