zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 9e72f317354de029f7e77600901c8cabcaf48c3e (tree)
parent 6361d7a92824ff2b883625d133fec4fccfb3eef7
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon, 10 May 2021 20:34:18 -0700

stage1: ignore enum ContainerLayout for comptime memory purposes

See #2115. The concept of `packed enum` and `extern enum` is
getting removed from the language.

Diffstat:
Msrc/stage1/ir.cpp | 23+++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp @@ -30550,22 +30550,13 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou case ZigTypeIdVector: return buf_read_value_bytes_array(ira, codegen, source_node, buf, val, val->type->data.vector.elem_type, val->type->data.vector.len); - case ZigTypeIdEnum: - switch (val->type->data.enumeration.layout) { - case ContainerLayoutAuto: - zig_panic("TODO buf_read_value_bytes enum auto"); - case ContainerLayoutPacked: - zig_panic("TODO buf_read_value_bytes enum packed"); - case ContainerLayoutExtern: { - ZigType *tag_int_type = val->type->data.enumeration.tag_int_type; - src_assert(tag_int_type->id == ZigTypeIdInt, source_node); - bigint_read_twos_complement(&val->data.x_enum_tag, buf, tag_int_type->data.integral.bit_count, - codegen->is_big_endian, tag_int_type->data.integral.is_signed); - return ErrorNone; - } - } - zig_unreachable(); - case ZigTypeIdStruct: + case ZigTypeIdEnum: { + ZigType *tag_int_type = val->type->data.enumeration.tag_int_type; + src_assert(tag_int_type->id == ZigTypeIdInt, source_node); + bigint_read_twos_complement(&val->data.x_enum_tag, buf, tag_int_type->data.integral.bit_count, + codegen->is_big_endian, tag_int_type->data.integral.is_signed); + return ErrorNone; + } case ZigTypeIdStruct: switch (val->type->data.structure.layout) { case ContainerLayoutAuto: { switch(val->type->data.structure.special){