| ... | ... | @@ -14577,8 +14577,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 14577 | 14577 | return ira->codegen->invalid_instruction; |
| 14578 | 14578 | if (type_is_invalid(struct_val->type)) |
| 14579 | 14579 | return ira->codegen->invalid_instruction; |
| 14580 | | ConstExprValue *field_val = &struct_val->data.x_struct.fields[field->src_index]; |
| 14581 | | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field_val->type, |
| 14580 | ZigType *ptr_type = get_pointer_to_type_extra(ira->codegen, field->type_entry, |
| 14582 | 14581 | is_const, is_volatile, PtrLenSingle, align_bytes, |
| 14583 | 14582 | (uint32_t)(ptr_bit_offset + field->bit_offset_in_host), |
| 14584 | 14583 | (uint32_t)host_int_bytes_for_result_type); |
| ... | ... | @@ -16883,16 +16882,12 @@ static void ensure_field_index(ZigType *type, const char *field_name, size_t ind |
| 16883 | 16882 | |
| 16884 | 16883 | static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) { |
| 16885 | 16884 | Error err; |
| 16886 | | static ConstExprValue *type_info_var = nullptr; // TODO oops this global variable made it past code review |
| 16887 | | static ZigType *type_info_type = nullptr; // TODO oops this global variable made it past code review |
| 16888 | | if (type_info_var == nullptr) { |
| 16889 | | type_info_var = get_builtin_value(ira->codegen, "TypeInfo"); |
| 16890 | | assert(type_info_var->type->id == ZigTypeIdMetaType); |
| 16885 | ConstExprValue *type_info_var = get_builtin_value(ira->codegen, "TypeInfo"); |
| 16886 | assert(type_info_var->type->id == ZigTypeIdMetaType); |
| 16887 | assertNoError(ensure_complete_type(ira->codegen, type_info_var->data.x_type)); |
| 16891 | 16888 | |
| 16892 | | assertNoError(ensure_complete_type(ira->codegen, type_info_var->data.x_type)); |
| 16893 | | type_info_type = type_info_var->data.x_type; |
| 16894 | | assert(type_info_type->id == ZigTypeIdUnion); |
| 16895 | | } |
| 16889 | ZigType *type_info_type = type_info_var->data.x_type; |
| 16890 | assert(type_info_type->id == ZigTypeIdUnion); |
| 16896 | 16891 | |
| 16897 | 16892 | if (type_name == nullptr && root == nullptr) |
| 16898 | 16893 | return type_info_type; |
| ... | ... | @@ -20180,8 +20175,29 @@ static Error buf_read_value_bytes(IrAnalyze *ira, AstNode *source_node, uint8_t |
| 20180 | 20175 | val->data.x_ptr.data.hard_coded_addr.addr = bigint_as_unsigned(&bn); |
| 20181 | 20176 | return ErrorNone; |
| 20182 | 20177 | } |
| 20183 | | case ZigTypeIdArray: |
| 20184 | | zig_panic("TODO buf_read_value_bytes array type"); |
| 20178 | case ZigTypeIdArray: { |
| 20179 | uint64_t elem_size = type_size(ira->codegen, val->type->data.array.child_type); |
| 20180 | size_t len = val->type->data.array.len; |
| 20181 | |
| 20182 | switch (val->data.x_array.special) { |
| 20183 | case ConstArraySpecialNone: |
| 20184 | val->data.x_array.data.s_none.elements = create_const_vals(len); |
| 20185 | for (size_t i = 0; i < len; i++) { |
| 20186 | ConstExprValue *elem = &val->data.x_array.data.s_none.elements[i]; |
| 20187 | elem->special = ConstValSpecialStatic; |
| 20188 | elem->type = val->type->data.array.child_type; |
| 20189 | if ((err = buf_read_value_bytes(ira, source_node, buf + (elem_size * i), elem))) |
| 20190 | return err; |
| 20191 | } |
| 20192 | break; |
| 20193 | case ConstArraySpecialUndef: |
| 20194 | zig_panic("TODO buf_read_value_bytes ConstArraySpecialUndef array type"); |
| 20195 | case ConstArraySpecialBuf: |
| 20196 | zig_panic("TODO buf_read_value_bytes ConstArraySpecialBuf array type"); |
| 20197 | } |
| 20198 | |
| 20199 | return ErrorNone; |
| 20200 | } |
| 20185 | 20201 | case ZigTypeIdStruct: |
| 20186 | 20202 | switch (val->type->data.structure.layout) { |
| 20187 | 20203 | case ContainerLayoutAuto: { |