mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
stage2: remove opaque type workaround from Type.ptrAlignment
This commit is contained in:
parent
7691013d10
commit
69bd2c243e
@ -16852,7 +16852,7 @@ fn beginComptimePtrLoad(
|
|||||||
};
|
};
|
||||||
return ComptimePtrLoadKit{
|
return ComptimePtrLoadKit{
|
||||||
.root_val = parent.root_val,
|
.root_val = parent.root_val,
|
||||||
.root_ty = parent.ty,
|
.root_ty = parent.root_ty,
|
||||||
.val = try parent.val.elemValue(sema.arena, elem_ptr.index),
|
.val = try parent.val.elemValue(sema.arena, elem_ptr.index),
|
||||||
.ty = elem_ty,
|
.ty = elem_ty,
|
||||||
.byte_offset = byte_offset,
|
.byte_offset = byte_offset,
|
||||||
@ -16868,7 +16868,7 @@ fn beginComptimePtrLoad(
|
|||||||
}
|
}
|
||||||
return ComptimePtrLoadKit{
|
return ComptimePtrLoadKit{
|
||||||
.root_val = parent.root_val,
|
.root_val = parent.root_val,
|
||||||
.root_ty = parent.ty,
|
.root_ty = parent.root_ty,
|
||||||
.val = parent.val,
|
.val = parent.val,
|
||||||
.ty = parent.ty,
|
.ty = parent.ty,
|
||||||
.byte_offset = parent.byte_offset,
|
.byte_offset = parent.byte_offset,
|
||||||
@ -16896,7 +16896,7 @@ fn beginComptimePtrLoad(
|
|||||||
};
|
};
|
||||||
return ComptimePtrLoadKit{
|
return ComptimePtrLoadKit{
|
||||||
.root_val = parent.root_val,
|
.root_val = parent.root_val,
|
||||||
.root_ty = parent.ty,
|
.root_ty = parent.root_ty,
|
||||||
.val = try parent.val.fieldValue(sema.arena, field_index),
|
.val = try parent.val.fieldValue(sema.arena, field_index),
|
||||||
.ty = parent.ty.structFieldType(field_index),
|
.ty = parent.ty.structFieldType(field_index),
|
||||||
.byte_offset = byte_offset,
|
.byte_offset = byte_offset,
|
||||||
|
|||||||
10
src/type.zig
10
src/type.zig
@ -2170,11 +2170,7 @@ pub const Type = extern union {
|
|||||||
.optional_single_mut_pointer,
|
.optional_single_mut_pointer,
|
||||||
=> {
|
=> {
|
||||||
const child_type = self.cast(Payload.ElemType).?.data;
|
const child_type = self.cast(Payload.ElemType).?.data;
|
||||||
if (child_type.zigTypeTag() == .Opaque) {
|
return child_type.abiAlignment(target);
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return child_type.abiAlignment(target);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.manyptr_u8,
|
.manyptr_u8,
|
||||||
@ -2188,8 +2184,6 @@ pub const Type = extern union {
|
|||||||
const ptr_info = self.castTag(.pointer).?.data;
|
const ptr_info = self.castTag(.pointer).?.data;
|
||||||
if (ptr_info.@"align" != 0) {
|
if (ptr_info.@"align" != 0) {
|
||||||
return ptr_info.@"align";
|
return ptr_info.@"align";
|
||||||
} else if (ptr_info.pointee_type.zigTypeTag() == .Opaque) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
} else {
|
||||||
return ptr_info.pointee_type.abiAlignment(target);
|
return ptr_info.pointee_type.abiAlignment(target);
|
||||||
}
|
}
|
||||||
@ -2246,6 +2240,7 @@ pub const Type = extern union {
|
|||||||
.export_options,
|
.export_options,
|
||||||
.extern_options,
|
.extern_options,
|
||||||
.@"opaque",
|
.@"opaque",
|
||||||
|
.anyopaque,
|
||||||
=> return 1,
|
=> return 1,
|
||||||
|
|
||||||
.fn_noreturn_no_args, // represents machine code; not a pointer
|
.fn_noreturn_no_args, // represents machine code; not a pointer
|
||||||
@ -2419,7 +2414,6 @@ pub const Type = extern union {
|
|||||||
|
|
||||||
.empty_struct,
|
.empty_struct,
|
||||||
.void,
|
.void,
|
||||||
.anyopaque,
|
|
||||||
.empty_struct_literal,
|
.empty_struct_literal,
|
||||||
.type,
|
.type,
|
||||||
.comptime_int,
|
.comptime_int,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user