| ... | @@ -9433,6 +9433,8 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so | ... | @@ -9433,6 +9433,8 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so |
| 9433 | TypeUnionField *union_field = find_union_field_by_tag(wanted_type, &val->data.x_enum_tag); | 9433 | TypeUnionField *union_field = find_union_field_by_tag(wanted_type, &val->data.x_enum_tag); |
| 9434 | assert(union_field != nullptr); | 9434 | assert(union_field != nullptr); |
| 9435 | type_ensure_zero_bits_known(ira->codegen, union_field->type_entry); | 9435 | type_ensure_zero_bits_known(ira->codegen, union_field->type_entry); |
| | 9436 | if (type_is_invalid(union_field->type_entry)) |
| | 9437 | return ira->codegen->invalid_instruction; |
| 9436 | if (!union_field->type_entry->zero_bits) { | 9438 | if (!union_field->type_entry->zero_bits) { |
| 9437 | AstNode *field_node = wanted_type->data.unionation.decl_node->data.container_decl.fields.at( | 9439 | AstNode *field_node = wanted_type->data.unionation.decl_node->data.container_decl.fields.at( |
| 9438 | union_field->enum_field->decl_index); | 9440 | union_field->enum_field->decl_index); |
| ... | @@ -10015,6 +10017,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -10015,6 +10017,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 10015 | if (actual_type->id == TypeTableEntryIdNumLitFloat || | 10017 | if (actual_type->id == TypeTableEntryIdNumLitFloat || |
| 10016 | actual_type->id == TypeTableEntryIdNumLitInt) | 10018 | actual_type->id == TypeTableEntryIdNumLitInt) |
| 10017 | { | 10019 | { |
| | 10020 | ensure_complete_type(ira->codegen, wanted_type); |
| | 10021 | if (type_is_invalid(wanted_type)) |
| | 10022 | return ira->codegen->invalid_instruction; |
| 10018 | if (wanted_type->id == TypeTableEntryIdEnum) { | 10023 | if (wanted_type->id == TypeTableEntryIdEnum) { |
| 10019 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.enumeration.tag_int_type, value); | 10024 | IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.enumeration.tag_int_type, value); |
| 10020 | if (type_is_invalid(cast1->value.type)) | 10025 | if (type_is_invalid(cast1->value.type)) |
| ... | @@ -12766,6 +12771,10 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op | ... | @@ -12766,6 +12771,10 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op |
| 12766 | TypeTableEntry *type_entry = ir_resolve_type(ira, value); | 12771 | TypeTableEntry *type_entry = ir_resolve_type(ira, value); |
| 12767 | if (type_is_invalid(type_entry)) | 12772 | if (type_is_invalid(type_entry)) |
| 12768 | return ira->codegen->builtin_types.entry_invalid; | 12773 | return ira->codegen->builtin_types.entry_invalid; |
| | 12774 | ensure_complete_type(ira->codegen, type_entry); |
| | 12775 | if (type_is_invalid(type_entry)) |
| | 12776 | return ira->codegen->builtin_types.entry_invalid; |
| | 12777 | |
| 12769 | switch (type_entry->id) { | 12778 | switch (type_entry->id) { |
| 12770 | case TypeTableEntryIdInvalid: | 12779 | case TypeTableEntryIdInvalid: |
| 12771 | zig_unreachable(); | 12780 | zig_unreachable(); |
| ... | @@ -13187,6 +13196,9 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc | ... | @@ -13187,6 +13196,9 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 13187 | | 13196 | |
| 13188 | bool safety_check_on = elem_ptr_instruction->safety_check_on; | 13197 | bool safety_check_on = elem_ptr_instruction->safety_check_on; |
| 13189 | ensure_complete_type(ira->codegen, return_type->data.pointer.child_type); | 13198 | ensure_complete_type(ira->codegen, return_type->data.pointer.child_type); |
| | 13199 | if (type_is_invalid(return_type->data.pointer.child_type)) |
| | 13200 | return ira->codegen->builtin_types.entry_invalid; |
| | 13201 | |
| 13190 | uint64_t elem_size = type_size(ira->codegen, return_type->data.pointer.child_type); | 13202 | uint64_t elem_size = type_size(ira->codegen, return_type->data.pointer.child_type); |
| 13191 | uint64_t abi_align = get_abi_alignment(ira->codegen, return_type->data.pointer.child_type); | 13203 | uint64_t abi_align = get_abi_alignment(ira->codegen, return_type->data.pointer.child_type); |
| 13192 | uint64_t ptr_align = return_type->data.pointer.alignment; | 13204 | uint64_t ptr_align = return_type->data.pointer.alignment; |
| ... | @@ -13696,7 +13708,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -13696,7 +13708,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 13696 | } | 13708 | } |
| 13697 | if (child_type->id == TypeTableEntryIdEnum) { | 13709 | if (child_type->id == TypeTableEntryIdEnum) { |
| 13698 | ensure_complete_type(ira->codegen, child_type); | 13710 | ensure_complete_type(ira->codegen, child_type); |
| 13699 | if (child_type->data.enumeration.is_invalid) | 13711 | if (type_is_invalid(child_type)) |
| 13700 | return ira->codegen->builtin_types.entry_invalid; | 13712 | return ira->codegen->builtin_types.entry_invalid; |
| 13701 | | 13713 | |
| 13702 | TypeEnumField *field = find_enum_type_field(child_type, field_name); | 13714 | TypeEnumField *field = find_enum_type_field(child_type, field_name); |
| ... | @@ -14569,27 +14581,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, | ... | @@ -14569,27 +14581,27 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 14569 | return ira->codegen->builtin_types.entry_invalid; | 14581 | return ira->codegen->builtin_types.entry_invalid; |
| 14570 | | 14582 | |
| 14571 | TypeTableEntry *ptr_type = value->value.type; | 14583 | TypeTableEntry *ptr_type = value->value.type; |
| 14572 | if (ptr_type->id == TypeTableEntryIdMetaType) { | 14584 | assert(ptr_type->id == TypeTableEntryIdPointer); |
| | 14585 | |
| | 14586 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; |
| | 14587 | if (type_is_invalid(type_entry)) { |
| | 14588 | return ira->codegen->builtin_types.entry_invalid; |
| | 14589 | } else if (type_entry->id == TypeTableEntryIdMetaType) { |
| 14573 | // surprise! actually this is just ??T not an unwrap maybe instruction | 14590 | // surprise! actually this is just ??T not an unwrap maybe instruction |
| 14574 | TypeTableEntry *ptr_type_ptr = ir_resolve_type(ira, value); | 14591 | ConstExprValue *ptr_val = const_ptr_pointee(ira->codegen, &value->value); |
| 14575 | assert(ptr_type_ptr->id == TypeTableEntryIdPointer); | 14592 | assert(ptr_val->type->id == TypeTableEntryIdMetaType); |
| 14576 | TypeTableEntry *child_type = ptr_type_ptr->data.pointer.child_type; | 14593 | TypeTableEntry *child_type = ptr_val->data.x_type; |
| | 14594 | |
| 14577 | type_ensure_zero_bits_known(ira->codegen, child_type); | 14595 | type_ensure_zero_bits_known(ira->codegen, child_type); |
| 14578 | TypeTableEntry *layer1 = get_maybe_type(ira->codegen, child_type); | 14596 | TypeTableEntry *layer1 = get_maybe_type(ira->codegen, child_type); |
| 14579 | TypeTableEntry *layer2 = get_maybe_type(ira->codegen, layer1); | 14597 | TypeTableEntry *layer2 = get_maybe_type(ira->codegen, layer1); |
| 14580 | TypeTableEntry *result_type = get_pointer_to_type(ira->codegen, layer2, true); | | |
| 14581 | | 14598 | |
| 14582 | IrInstruction *const_instr = ir_build_const_type(&ira->new_irb, unwrap_maybe_instruction->base.scope, | 14599 | IrInstruction *const_instr = ir_build_const_type(&ira->new_irb, unwrap_maybe_instruction->base.scope, |
| 14583 | unwrap_maybe_instruction->base.source_node, result_type); | 14600 | unwrap_maybe_instruction->base.source_node, layer2); |
| 14584 | ir_link_new_instruction(const_instr, &unwrap_maybe_instruction->base); | 14601 | IrInstruction *result_instr = ir_get_ref(ira, &unwrap_maybe_instruction->base, const_instr, |
| 14585 | return const_instr->value.type; | 14602 | ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile); |
| 14586 | } | 14603 | ir_link_new_instruction(result_instr, &unwrap_maybe_instruction->base); |
| 14587 | | 14604 | return result_instr->value.type; |
| 14588 | assert(ptr_type->id == TypeTableEntryIdPointer); | | |
| 14589 | | | |
| 14590 | TypeTableEntry *type_entry = ptr_type->data.pointer.child_type; | | |
| 14591 | if (type_is_invalid(type_entry)) { | | |
| 14592 | return ira->codegen->builtin_types.entry_invalid; | | |
| 14593 | } else if (type_entry->id != TypeTableEntryIdMaybe) { | 14605 | } else if (type_entry->id != TypeTableEntryIdMaybe) { |
| 14594 | ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node, | 14606 | ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node, |
| 14595 | buf_sprintf("expected nullable type, found '%s'", buf_ptr(&type_entry->name))); | 14607 | buf_sprintf("expected nullable type, found '%s'", buf_ptr(&type_entry->name))); |
| ... | @@ -15115,6 +15127,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir | ... | @@ -15115,6 +15127,8 @@ static TypeTableEntry *ir_analyze_container_init_fields_union(IrAnalyze *ira, Ir |
| 15115 | assert(container_type->id == TypeTableEntryIdUnion); | 15127 | assert(container_type->id == TypeTableEntryIdUnion); |
| 15116 | | 15128 | |
| 15117 | ensure_complete_type(ira->codegen, container_type); | 15129 | ensure_complete_type(ira->codegen, container_type); |
| | 15130 | if (type_is_invalid(container_type)) |
| | 15131 | return ira->codegen->builtin_types.entry_invalid; |
| 15118 | | 15132 | |
| 15119 | if (instr_field_count != 1) { | 15133 | if (instr_field_count != 1) { |
| 15120 | ir_add_error(ira, instruction, | 15134 | ir_add_error(ira, instruction, |
| ... | @@ -15182,6 +15196,8 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru | ... | @@ -15182,6 +15196,8 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 15182 | } | 15196 | } |
| 15183 | | 15197 | |
| 15184 | ensure_complete_type(ira->codegen, container_type); | 15198 | ensure_complete_type(ira->codegen, container_type); |
| | 15199 | if (type_is_invalid(container_type)) |
| | 15200 | return ira->codegen->builtin_types.entry_invalid; |
| 15185 | | 15201 | |
| 15186 | size_t actual_field_count = container_type->data.structure.src_field_count; | 15202 | size_t actual_field_count = container_type->data.structure.src_field_count; |
| 15187 | | 15203 | |
| ... | @@ -15687,6 +15703,8 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, | ... | @@ -15687,6 +15703,8 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, |
| 15687 | return ira->codegen->builtin_types.entry_invalid; | 15703 | return ira->codegen->builtin_types.entry_invalid; |
| 15688 | | 15704 | |
| 15689 | ensure_complete_type(ira->codegen, container_type); | 15705 | ensure_complete_type(ira->codegen, container_type); |
| | 15706 | if (type_is_invalid(container_type)) |
| | 15707 | return ira->codegen->builtin_types.entry_invalid; |
| 15690 | | 15708 | |
| 15691 | IrInstruction *field_name_value = instruction->field_name->other; | 15709 | IrInstruction *field_name_value = instruction->field_name->other; |
| 15692 | Buf *field_name = ir_resolve_str(ira, field_name_value); | 15710 | Buf *field_name = ir_resolve_str(ira, field_name_value); |
| ... | @@ -15740,6 +15758,9 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na | ... | @@ -15740,6 +15758,9 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na |
| 15740 | assert(type_info_var->type->id == TypeTableEntryIdMetaType); | 15758 | assert(type_info_var->type->id == TypeTableEntryIdMetaType); |
| 15741 | | 15759 | |
| 15742 | ensure_complete_type(ira->codegen, type_info_var->data.x_type); | 15760 | ensure_complete_type(ira->codegen, type_info_var->data.x_type); |
| | 15761 | if (type_is_invalid(type_info_var->data.x_type)) |
| | 15762 | return ira->codegen->builtin_types.entry_invalid; |
| | 15763 | |
| 15743 | type_info_type = type_info_var->data.x_type; | 15764 | type_info_type = type_info_var->data.x_type; |
| 15744 | assert(type_info_type->id == TypeTableEntryIdUnion); | 15765 | assert(type_info_type->id == TypeTableEntryIdUnion); |
| 15745 | } | 15766 | } |
| ... | @@ -15765,26 +15786,37 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na | ... | @@ -15765,26 +15786,37 @@ static TypeTableEntry *ir_type_info_get_type(IrAnalyze *ira, const char *type_na |
| 15765 | VariableTableEntry *var = tld->var; | 15786 | VariableTableEntry *var = tld->var; |
| 15766 | | 15787 | |
| 15767 | ensure_complete_type(ira->codegen, var->value->type); | 15788 | ensure_complete_type(ira->codegen, var->value->type); |
| | 15789 | if (type_is_invalid(var->value->type)) |
| | 15790 | return ira->codegen->builtin_types.entry_invalid; |
| 15768 | assert(var->value->type->id == TypeTableEntryIdMetaType); | 15791 | assert(var->value->type->id == TypeTableEntryIdMetaType); |
| 15769 | return var->value->data.x_type; | 15792 | return var->value->data.x_type; |
| 15770 | } | 15793 | } |
| 15771 | | 15794 | |
| 15772 | static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope) | 15795 | static bool ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, ScopeDecls *decls_scope) |
| 15773 | { | 15796 | { |
| 15774 | TypeTableEntry *type_info_definition_type = ir_type_info_get_type(ira, "Definition"); | 15797 | TypeTableEntry *type_info_definition_type = ir_type_info_get_type(ira, "Definition"); |
| 15775 | ensure_complete_type(ira->codegen, type_info_definition_type); | 15798 | ensure_complete_type(ira->codegen, type_info_definition_type); |
| | 15799 | if (type_is_invalid(type_info_definition_type)) |
| | 15800 | return false; |
| | 15801 | |
| 15776 | ensure_field_index(type_info_definition_type, "name", 0); | 15802 | ensure_field_index(type_info_definition_type, "name", 0); |
| 15777 | ensure_field_index(type_info_definition_type, "is_pub", 1); | 15803 | ensure_field_index(type_info_definition_type, "is_pub", 1); |
| 15778 | ensure_field_index(type_info_definition_type, "data", 2); | 15804 | ensure_field_index(type_info_definition_type, "data", 2); |
| 15779 | | 15805 | |
| 15780 | TypeTableEntry *type_info_definition_data_type = ir_type_info_get_type(ira, "Data", type_info_definition_type); | 15806 | TypeTableEntry *type_info_definition_data_type = ir_type_info_get_type(ira, "Data", type_info_definition_type); |
| 15781 | ensure_complete_type(ira->codegen, type_info_definition_data_type); | 15807 | ensure_complete_type(ira->codegen, type_info_definition_data_type); |
| | 15808 | if (type_is_invalid(type_info_definition_data_type)) |
| | 15809 | return false; |
| 15782 | | 15810 | |
| 15783 | TypeTableEntry *type_info_fn_def_type = ir_type_info_get_type(ira, "FnDef", type_info_definition_data_type); | 15811 | TypeTableEntry *type_info_fn_def_type = ir_type_info_get_type(ira, "FnDef", type_info_definition_data_type); |
| 15784 | ensure_complete_type(ira->codegen, type_info_fn_def_type); | 15812 | ensure_complete_type(ira->codegen, type_info_fn_def_type); |
| | 15813 | if (type_is_invalid(type_info_fn_def_type)) |
| | 15814 | return false; |
| 15785 | | 15815 | |
| 15786 | TypeTableEntry *type_info_fn_def_inline_type = ir_type_info_get_type(ira, "Inline", type_info_fn_def_type); | 15816 | TypeTableEntry *type_info_fn_def_inline_type = ir_type_info_get_type(ira, "Inline", type_info_fn_def_type); |
| 15787 | ensure_complete_type(ira->codegen, type_info_fn_def_inline_type); | 15817 | ensure_complete_type(ira->codegen, type_info_fn_def_inline_type); |
| | 15818 | if (type_is_invalid(type_info_fn_def_inline_type)) |
| | 15819 | return false; |
| 15788 | | 15820 | |
| 15789 | // Loop through our definitions once to figure out how many definitions we will generate info for. | 15821 | // Loop through our definitions once to figure out how many definitions we will generate info for. |
| 15790 | auto decl_it = decls_scope->decl_table.entry_iterator(); | 15822 | auto decl_it = decls_scope->decl_table.entry_iterator(); |
| ... | @@ -15799,7 +15831,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -15799,7 +15831,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 15799 | resolve_top_level_decl(ira->codegen, curr_entry->value, false, curr_entry->value->source_node); | 15831 | resolve_top_level_decl(ira->codegen, curr_entry->value, false, curr_entry->value->source_node); |
| 15800 | if (curr_entry->value->resolution != TldResolutionOk) | 15832 | if (curr_entry->value->resolution != TldResolutionOk) |
| 15801 | { | 15833 | { |
| 15802 | return; | 15834 | return false; |
| 15803 | } | 15835 | } |
| 15804 | } | 15836 | } |
| 15805 | | 15837 | |
| ... | @@ -15864,6 +15896,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -15864,6 +15896,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 15864 | { | 15896 | { |
| 15865 | VariableTableEntry *var = ((TldVar *)curr_entry->value)->var; | 15897 | VariableTableEntry *var = ((TldVar *)curr_entry->value)->var; |
| 15866 | ensure_complete_type(ira->codegen, var->value->type); | 15898 | ensure_complete_type(ira->codegen, var->value->type); |
| | 15899 | if (type_is_invalid(var->value->type)) |
| | 15900 | return false; |
| | 15901 | |
| 15867 | if (var->value->type->id == TypeTableEntryIdMetaType) | 15902 | if (var->value->type->id == TypeTableEntryIdMetaType) |
| 15868 | { | 15903 | { |
| 15869 | // We have a variable of type 'type', so it's actually a type definition. | 15904 | // We have a variable of type 'type', so it's actually a type definition. |
| ... | @@ -15991,6 +16026,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -15991,6 +16026,9 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 15991 | { | 16026 | { |
| 15992 | TypeTableEntry *type_entry = ((TldContainer *)curr_entry->value)->type_entry; | 16027 | TypeTableEntry *type_entry = ((TldContainer *)curr_entry->value)->type_entry; |
| 15993 | ensure_complete_type(ira->codegen, type_entry); | 16028 | ensure_complete_type(ira->codegen, type_entry); |
| | 16029 | if (type_is_invalid(type_entry)) |
| | 16030 | return false; |
| | 16031 | |
| 15994 | // This is a type. | 16032 | // This is a type. |
| 15995 | bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 0); | 16033 | bigint_init_unsigned(&inner_fields[2].data.x_union.tag, 0); |
| 15996 | | 16034 | |
| ... | @@ -16011,6 +16049,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop | ... | @@ -16011,6 +16049,7 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop |
| 16011 | } | 16049 | } |
| 16012 | | 16050 | |
| 16013 | assert(definition_index == definition_count); | 16051 | assert(definition_index == definition_count); |
| | 16052 | return true; |
| 16014 | } | 16053 | } |
| 16015 | | 16054 | |
| 16016 | static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry) | 16055 | static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *type_entry) |
| ... | @@ -16019,6 +16058,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t | ... | @@ -16019,6 +16058,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16019 | assert(!type_is_invalid(type_entry)); | 16058 | assert(!type_is_invalid(type_entry)); |
| 16020 | | 16059 | |
| 16021 | ensure_complete_type(ira->codegen, type_entry); | 16060 | ensure_complete_type(ira->codegen, type_entry); |
| | 16061 | if (type_is_invalid(type_entry)) |
| | 16062 | return nullptr; |
| 16022 | | 16063 | |
| 16023 | const auto make_enum_field_val = [ira](ConstExprValue *enum_field_val, TypeEnumField *enum_field, | 16064 | const auto make_enum_field_val = [ira](ConstExprValue *enum_field_val, TypeEnumField *enum_field, |
| 16024 | TypeTableEntry *type_info_enum_field_type) { | 16065 | TypeTableEntry *type_info_enum_field_type) { |
| ... | @@ -16246,7 +16287,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t | ... | @@ -16246,7 +16287,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16246 | } | 16287 | } |
| 16247 | // defs: []TypeInfo.Definition | 16288 | // defs: []TypeInfo.Definition |
| 16248 | ensure_field_index(result->type, "defs", 3); | 16289 | ensure_field_index(result->type, "defs", 3); |
| 16249 | ir_make_type_info_defs(ira, &fields[3], type_entry->data.enumeration.decls_scope); | 16290 | if (!ir_make_type_info_defs(ira, &fields[3], type_entry->data.enumeration.decls_scope)) |
| | 16291 | return nullptr; |
| 16250 | | 16292 | |
| 16251 | break; | 16293 | break; |
| 16252 | } | 16294 | } |
| ... | @@ -16401,7 +16443,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t | ... | @@ -16401,7 +16443,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16401 | } | 16443 | } |
| 16402 | // defs: []TypeInfo.Definition | 16444 | // defs: []TypeInfo.Definition |
| 16403 | ensure_field_index(result->type, "defs", 3); | 16445 | ensure_field_index(result->type, "defs", 3); |
| 16404 | ir_make_type_info_defs(ira, &fields[3], type_entry->data.unionation.decls_scope); | 16446 | if (!ir_make_type_info_defs(ira, &fields[3], type_entry->data.unionation.decls_scope)) |
| | 16447 | return nullptr; |
| 16405 | | 16448 | |
| 16406 | break; | 16449 | break; |
| 16407 | } | 16450 | } |
| ... | @@ -16412,6 +16455,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t | ... | @@ -16412,6 +16455,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16412 | buf_init_from_str(&ptr_field_name, "ptr"); | 16455 | buf_init_from_str(&ptr_field_name, "ptr"); |
| 16413 | TypeTableEntry *ptr_type = type_entry->data.structure.fields_by_name.get(&ptr_field_name)->type_entry; | 16456 | TypeTableEntry *ptr_type = type_entry->data.structure.fields_by_name.get(&ptr_field_name)->type_entry; |
| 16414 | ensure_complete_type(ira->codegen, ptr_type); | 16457 | ensure_complete_type(ira->codegen, ptr_type); |
| | 16458 | if (type_is_invalid(ptr_type)) |
| | 16459 | return nullptr; |
| 16415 | buf_deinit(&ptr_field_name); | 16460 | buf_deinit(&ptr_field_name); |
| 16416 | | 16461 | |
| 16417 | result = create_ptr_like_type_info("Slice", ptr_type); | 16462 | result = create_ptr_like_type_info("Slice", ptr_type); |
| ... | @@ -16482,7 +16527,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t | ... | @@ -16482,7 +16527,8 @@ static ConstExprValue *ir_make_type_info_value(IrAnalyze *ira, TypeTableEntry *t |
| 16482 | } | 16527 | } |
| 16483 | // defs: []TypeInfo.Definition | 16528 | // defs: []TypeInfo.Definition |
| 16484 | ensure_field_index(result->type, "defs", 2); | 16529 | ensure_field_index(result->type, "defs", 2); |
| 16485 | ir_make_type_info_defs(ira, &fields[2], type_entry->data.structure.decls_scope); | 16530 | if (!ir_make_type_info_defs(ira, &fields[2], type_entry->data.structure.decls_scope)) |
| | 16531 | return nullptr; |
| 16486 | | 16532 | |
| 16487 | break; | 16533 | break; |
| 16488 | } | 16534 | } |
| ... | @@ -17502,6 +17548,11 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst | ... | @@ -17502,6 +17548,11 @@ static TypeTableEntry *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInst |
| 17502 | if (type_is_invalid(container_type)) | 17548 | if (type_is_invalid(container_type)) |
| 17503 | return ira->codegen->builtin_types.entry_invalid; | 17549 | return ira->codegen->builtin_types.entry_invalid; |
| 17504 | | 17550 | |
| | 17551 | ensure_complete_type(ira->codegen, container_type); |
| | 17552 | if (type_is_invalid(container_type)) |
| | 17553 | return ira->codegen->builtin_types.entry_invalid; |
| | 17554 | |
| | 17555 | |
| 17505 | uint64_t member_index; | 17556 | uint64_t member_index; |
| 17506 | IrInstruction *index_value = instruction->member_index->other; | 17557 | IrInstruction *index_value = instruction->member_index->other; |
| 17507 | if (!ir_resolve_usize(ira, index_value, &member_index)) | 17558 | if (!ir_resolve_usize(ira, index_value, &member_index)) |
| ... | @@ -17544,6 +17595,10 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst | ... | @@ -17544,6 +17595,10 @@ static TypeTableEntry *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInst |
| 17544 | if (type_is_invalid(container_type)) | 17595 | if (type_is_invalid(container_type)) |
| 17545 | return ira->codegen->builtin_types.entry_invalid; | 17596 | return ira->codegen->builtin_types.entry_invalid; |
| 17546 | | 17597 | |
| | 17598 | ensure_complete_type(ira->codegen, container_type); |
| | 17599 | if (type_is_invalid(container_type)) |
| | 17600 | return ira->codegen->builtin_types.entry_invalid; |
| | 17601 | |
| 17547 | uint64_t member_index; | 17602 | uint64_t member_index; |
| 17548 | IrInstruction *index_value = instruction->member_index->other; | 17603 | IrInstruction *index_value = instruction->member_index->other; |
| 17549 | if (!ir_resolve_usize(ira, index_value, &member_index)) | 17604 | if (!ir_resolve_usize(ira, index_value, &member_index)) |
| ... | @@ -18485,7 +18540,12 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc | ... | @@ -18485,7 +18540,12 @@ static TypeTableEntry *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstruc |
| 18485 | return ira->codegen->builtin_types.entry_invalid; | 18540 | return ira->codegen->builtin_types.entry_invalid; |
| 18486 | | 18541 | |
| 18487 | ensure_complete_type(ira->codegen, dest_type); | 18542 | ensure_complete_type(ira->codegen, dest_type); |
| | 18543 | if (type_is_invalid(dest_type)) |
| | 18544 | return ira->codegen->builtin_types.entry_invalid; |
| | 18545 | |
| 18488 | ensure_complete_type(ira->codegen, src_type); | 18546 | ensure_complete_type(ira->codegen, src_type); |
| | 18547 | if (type_is_invalid(src_type)) |
| | 18548 | return ira->codegen->builtin_types.entry_invalid; |
| 18489 | | 18549 | |
| 18490 | if (get_codegen_ptr_type(src_type) != nullptr) { | 18550 | if (get_codegen_ptr_type(src_type) != nullptr) { |
| 18491 | ir_add_error(ira, value, | 18551 | ir_add_error(ira, value, |
| ... | @@ -18724,6 +18784,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc | ... | @@ -18724,6 +18784,9 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstruc |
| 18724 | if (!ir_resolve_align(ira, instruction->align_value->other, &align_bytes)) | 18784 | if (!ir_resolve_align(ira, instruction->align_value->other, &align_bytes)) |
| 18725 | return ira->codegen->builtin_types.entry_invalid; | 18785 | return ira->codegen->builtin_types.entry_invalid; |
| 18726 | } else { | 18786 | } else { |
| | 18787 | type_ensure_zero_bits_known(ira->codegen, child_type); |
| | 18788 | if (type_is_invalid(child_type)) |
| | 18789 | return ira->codegen->builtin_types.entry_invalid; |
| 18727 | align_bytes = get_abi_alignment(ira->codegen, child_type); | 18790 | align_bytes = get_abi_alignment(ira->codegen, child_type); |
| 18728 | } | 18791 | } |
| 18729 | | 18792 | |