diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-14 21:11:49 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-14 21:43:03 -0700 |
| commit | 2f92d1a0264b6827cb67a55726c4c9a082337508 (patch) | |
| tree | d6691a25a828b44cb4c17365fb8549d339046810 /src/Module.zig | |
| parent | 50a1ca24ca2a4311097132d660b8244f252da82f (diff) | |
| download | zig-2f92d1a0264b6827cb67a55726c4c9a082337508.tar.gz zig-2f92d1a0264b6827cb67a55726c4c9a082337508.zip | |
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`.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Module.zig b/src/Module.zig index 7c6c654660..20bf25af03 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -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`. |
