authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-03 19:06:54+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-03 22:16:49+02:00
log69bd2c243e23fa2d4df2ec50802bd4b453211bfd
tree5c20c8cad724fc759437e39ddd5a0bed00d781f1
parent7691013d10525ded6e02228cf89db94719bac1c5

stage2: remove opaque type workaround from `Type.ptrAlignment`


2 files changed, 5 insertions(+), 11 deletions(-)

src/Sema.zig+3-3
......@@ -16852,7 +16852,7 @@ fn beginComptimePtrLoad(
1685216852 };
1685316853 return ComptimePtrLoadKit{
1685416854 .root_val = parent.root_val,
16855 .root_ty = parent.ty,
16855 .root_ty = parent.root_ty,
1685616856 .val = try parent.val.elemValue(sema.arena, elem_ptr.index),
1685716857 .ty = elem_ty,
1685816858 .byte_offset = byte_offset,
......@@ -16868,7 +16868,7 @@ fn beginComptimePtrLoad(
1686816868 }
1686916869 return ComptimePtrLoadKit{
1687016870 .root_val = parent.root_val,
16871 .root_ty = parent.ty,
16871 .root_ty = parent.root_ty,
1687216872 .val = parent.val,
1687316873 .ty = parent.ty,
1687416874 .byte_offset = parent.byte_offset,
......@@ -16896,7 +16896,7 @@ fn beginComptimePtrLoad(
1689616896 };
1689716897 return ComptimePtrLoadKit{
1689816898 .root_val = parent.root_val,
16899 .root_ty = parent.ty,
16899 .root_ty = parent.root_ty,
1690016900 .val = try parent.val.fieldValue(sema.arena, field_index),
1690116901 .ty = parent.ty.structFieldType(field_index),
1690216902 .byte_offset = byte_offset,
src/type.zig+2-8
......@@ -2170,11 +2170,7 @@ pub const Type = extern union {
21702170 .optional_single_mut_pointer,
21712171 => {
21722172 const child_type = self.cast(Payload.ElemType).?.data;
2173 if (child_type.zigTypeTag() == .Opaque) {
2174 return 1;
2175 } else {
2176 return child_type.abiAlignment(target);
2177 }
2173 return child_type.abiAlignment(target);
21782174 },
21792175
21802176 .manyptr_u8,
......@@ -2188,8 +2184,6 @@ pub const Type = extern union {
21882184 const ptr_info = self.castTag(.pointer).?.data;
21892185 if (ptr_info.@"align" != 0) {
21902186 return ptr_info.@"align";
2191 } else if (ptr_info.pointee_type.zigTypeTag() == .Opaque) {
2192 return 1;
21932187 } else {
21942188 return ptr_info.pointee_type.abiAlignment(target);
21952189 }
......@@ -2246,6 +2240,7 @@ pub const Type = extern union {
22462240 .export_options,
22472241 .extern_options,
22482242 .@"opaque",
2243 .anyopaque,
22492244 => return 1,
22502245
22512246 .fn_noreturn_no_args, // represents machine code; not a pointer
......@@ -2419,7 +2414,6 @@ pub const Type = extern union {
24192414
24202415 .empty_struct,
24212416 .void,
2422 .anyopaque,
24232417 .empty_struct_literal,
24242418 .type,
24252419 .comptime_int,