stage2: fixups for topolarity-comptime-memory-reinterp branch
* don't store `has_well_defined_layout` in memory. * remove struct `hasWellDefinedLayout` logic. it's just `layout != .Auto`. This means we only need one implementation, in Type. * fix some of the cases being wrong in `hasWellDefinedLayout`, such as optional pointers. * move `tag_ty_inferred` field into a position that makes it more obvious how the struct layout will be done. Also we don't have a compiler that intelligently moves fields around so this layout is better. * Sema: don't `resolveTypeLayout` in `zirCoerceResultPtr` unless necessary. * Rename `ComptimePtrLoadKit` `target` field to `pointee` to avoid confusion with `target`.
This commit is contained in:
@@ -885,7 +885,6 @@ pub const Struct = struct {
|
||||
/// one possible value.
|
||||
known_non_opv: bool,
|
||||
requires_comptime: PropertyBoolean = .unknown,
|
||||
has_well_defined_layout: PropertyBoolean = .unknown,
|
||||
|
||||
pub const Fields = std.StringArrayHashMapUnmanaged(Field);
|
||||
|
||||
@@ -1080,8 +1079,6 @@ pub const EnumFull = struct {
|
||||
/// An integer type which is used for the numerical value of the enum.
|
||||
/// Whether zig chooses this type or the user specifies it, it is stored here.
|
||||
tag_ty: Type,
|
||||
/// true if zig inferred this tag type, false if user specified it
|
||||
tag_ty_inferred: bool,
|
||||
/// Set of field names in declaration order.
|
||||
fields: NameMap,
|
||||
/// Maps integer tag value to field index.
|
||||
@@ -1092,6 +1089,8 @@ pub const EnumFull = struct {
|
||||
namespace: Namespace,
|
||||
/// Offset from `owner_decl`, points to the enum decl AST node.
|
||||
node_offset: i32,
|
||||
/// true if zig inferred this tag type, false if user specified it
|
||||
tag_ty_inferred: bool,
|
||||
|
||||
pub const NameMap = std.StringArrayHashMapUnmanaged(void);
|
||||
pub const ValueMap = std.ArrayHashMapUnmanaged(Value, void, Value.ArrayHashContext, false);
|
||||
@@ -1136,7 +1135,6 @@ pub const Union = struct {
|
||||
fully_resolved,
|
||||
},
|
||||
requires_comptime: PropertyBoolean = .unknown,
|
||||
has_well_defined_layout: PropertyBoolean = .unknown,
|
||||
|
||||
pub const Field = struct {
|
||||
/// undefined until `status` is `have_field_types` or `have_layout`.
|
||||
|
||||
Reference in New Issue
Block a user