| ... | ... | @@ -4286,17 +4286,19 @@ static void add_call_stack_errors(CodeGen *codegen, IrExecutable *exec, ErrorMsg |
| 4286 | 4286 | add_call_stack_errors(codegen, exec->parent_exec, err_msg, limit - 1); |
| 4287 | 4287 | } |
| 4288 | 4288 | |
| 4289 | | // TODO migrate the rest of the add_node_error errors to use this so that we get better |
| 4290 | | // messages for generic instantiations |
| 4291 | | static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction, Buf *msg) { |
| 4289 | static ErrorMsg *ir_add_error_node(IrAnalyze *ira, AstNode *source_node, Buf *msg) { |
| 4292 | 4290 | ira->new_irb.exec->invalid = true; |
| 4293 | | ErrorMsg *err_msg = add_node_error(ira->codegen, source_instruction->source_node, msg); |
| 4291 | ErrorMsg *err_msg = add_node_error(ira->codegen, source_node, msg); |
| 4294 | 4292 | if (ira->new_irb.exec->parent_exec) { |
| 4295 | 4293 | add_call_stack_errors(ira->codegen, ira->new_irb.exec, err_msg, 10); |
| 4296 | 4294 | } |
| 4297 | 4295 | return err_msg; |
| 4298 | 4296 | } |
| 4299 | 4297 | |
| 4298 | static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction, Buf *msg) { |
| 4299 | return ir_add_error_node(ira, source_instruction->source_node, msg); |
| 4300 | } |
| 4301 | |
| 4300 | 4302 | static IrInstruction *ir_exec_const_result(IrExecutable *exec) { |
| 4301 | 4303 | if (exec->basic_block_list.length != 1) |
| 4302 | 4304 | return nullptr; |
| ... | ... | @@ -4546,7 +4548,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 4546 | 4548 | return ira->codegen->builtin_types.entry_invalid; |
| 4547 | 4549 | } |
| 4548 | 4550 | } else { |
| 4549 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 4551 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 4550 | 4552 | buf_sprintf("incompatible types: '%s' and '%s'", |
| 4551 | 4553 | buf_ptr(&prev_type->name), buf_ptr(&cur_type->name))); |
| 4552 | 4554 | add_error_note(ira->codegen, msg, prev_inst->source_node, |
| ... | ... | @@ -4561,11 +4563,11 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 4561 | 4563 | if (prev_inst->type_entry->id == TypeTableEntryIdNumLitInt || |
| 4562 | 4564 | prev_inst->type_entry->id == TypeTableEntryIdNumLitFloat) |
| 4563 | 4565 | { |
| 4564 | | add_node_error(ira->codegen, source_node, |
| 4566 | ir_add_error_node(ira, source_node, |
| 4565 | 4567 | buf_sprintf("unable to make error union out of number literal")); |
| 4566 | 4568 | return ira->codegen->builtin_types.entry_invalid; |
| 4567 | 4569 | } else if (prev_inst->type_entry->id == TypeTableEntryIdNullLit) { |
| 4568 | | add_node_error(ira->codegen, source_node, |
| 4570 | ir_add_error_node(ira, source_node, |
| 4569 | 4571 | buf_sprintf("unable to make error union out of null literal")); |
| 4570 | 4572 | return ira->codegen->builtin_types.entry_invalid; |
| 4571 | 4573 | } else { |
| ... | ... | @@ -4575,7 +4577,7 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod |
| 4575 | 4577 | if (prev_inst->type_entry->id == TypeTableEntryIdNumLitInt || |
| 4576 | 4578 | prev_inst->type_entry->id == TypeTableEntryIdNumLitFloat) |
| 4577 | 4579 | { |
| 4578 | | add_node_error(ira->codegen, source_node, |
| 4580 | ir_add_error_node(ira, source_node, |
| 4579 | 4581 | buf_sprintf("unable to make maybe out of number literal")); |
| 4580 | 4582 | return ira->codegen->builtin_types.entry_invalid; |
| 4581 | 4583 | } else { |
| ... | ... | @@ -4878,7 +4880,7 @@ static FnTableEntry *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) { |
| 4878 | 4880 | return nullptr; |
| 4879 | 4881 | |
| 4880 | 4882 | if (fn_value->type_entry->id != TypeTableEntryIdFn) { |
| 4881 | | add_node_error(ira->codegen, fn_value->source_node, |
| 4883 | ir_add_error_node(ira, fn_value->source_node, |
| 4882 | 4884 | buf_sprintf("expected function type, found '%s'", buf_ptr(&fn_value->type_entry->name))); |
| 4883 | 4885 | return nullptr; |
| 4884 | 4886 | } |
| ... | ... | @@ -5114,7 +5116,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 5114 | 5116 | if (actual_type->data.array.len % child_type_size == 0) { |
| 5115 | 5117 | return ir_resolve_cast(ira, source_instr, value, wanted_type, CastOpBytesToSlice, true); |
| 5116 | 5118 | } else { |
| 5117 | | add_node_error(ira->codegen, source_instr->source_node, |
| 5119 | ir_add_error_node(ira, source_instr->source_node, |
| 5118 | 5120 | buf_sprintf("unable to convert %s to %s: size mismatch", |
| 5119 | 5121 | buf_ptr(&actual_type->name), buf_ptr(&wanted_type->name))); |
| 5120 | 5122 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -5222,7 +5224,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 5222 | 5224 | { |
| 5223 | 5225 | return ir_resolve_cast(ira, source_instr, value, wanted_type, CastOpErrToInt, false); |
| 5224 | 5226 | } else { |
| 5225 | | add_node_error(ira->codegen, source_instr->source_node, |
| 5227 | ir_add_error_node(ira, source_instr->source_node, |
| 5226 | 5228 | buf_sprintf("too many error values to fit in '%s'", buf_ptr(&wanted_type->name))); |
| 5227 | 5229 | return ira->codegen->invalid_instruction; |
| 5228 | 5230 | } |
| ... | ... | @@ -5257,7 +5259,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 5257 | 5259 | } |
| 5258 | 5260 | } |
| 5259 | 5261 | |
| 5260 | | add_node_error(ira->codegen, source_instr->source_node, |
| 5262 | ir_add_error_node(ira, source_instr->source_node, |
| 5261 | 5263 | buf_sprintf("invalid cast from type '%s' to '%s'", |
| 5262 | 5264 | buf_ptr(&actual_type->name), |
| 5263 | 5265 | buf_ptr(&wanted_type->name))); |
| ... | ... | @@ -5329,7 +5331,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc |
| 5329 | 5331 | return ira->codegen->invalid_instruction; |
| 5330 | 5332 | } |
| 5331 | 5333 | } else { |
| 5332 | | add_node_error(ira->codegen, source_instruction->source_node, |
| 5334 | ir_add_error_node(ira, source_instruction->source_node, |
| 5333 | 5335 | buf_sprintf("attempt to dereference non pointer type '%s'", |
| 5334 | 5336 | buf_ptr(&type_entry->name))); |
| 5335 | 5337 | return ira->codegen->invalid_instruction; |
| ... | ... | @@ -5534,7 +5536,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 5534 | 5536 | case TypeTableEntryIdBlock: |
| 5535 | 5537 | case TypeTableEntryIdBoundFn: |
| 5536 | 5538 | if (!is_equality_cmp) { |
| 5537 | | add_node_error(ira->codegen, source_node, |
| 5539 | ir_add_error_node(ira, source_node, |
| 5538 | 5540 | buf_sprintf("operator not allowed for type '%s'", buf_ptr(&resolved_type->name))); |
| 5539 | 5541 | return ira->codegen->builtin_types.entry_invalid; |
| 5540 | 5542 | } |
| ... | ... | @@ -5542,7 +5544,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 5542 | 5544 | |
| 5543 | 5545 | case TypeTableEntryIdEnum: |
| 5544 | 5546 | if (!is_equality_cmp || resolved_type->data.enumeration.gen_field_count != 0) { |
| 5545 | | add_node_error(ira->codegen, source_node, |
| 5547 | ir_add_error_node(ira, source_node, |
| 5546 | 5548 | buf_sprintf("operator not allowed for type '%s'", buf_ptr(&resolved_type->name))); |
| 5547 | 5549 | return ira->codegen->builtin_types.entry_invalid; |
| 5548 | 5550 | } |
| ... | ... | @@ -5556,7 +5558,7 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 5556 | 5558 | case TypeTableEntryIdMaybe: |
| 5557 | 5559 | case TypeTableEntryIdErrorUnion: |
| 5558 | 5560 | case TypeTableEntryIdUnion: |
| 5559 | | add_node_error(ira->codegen, source_node, |
| 5561 | ir_add_error_node(ira, source_node, |
| 5560 | 5562 | buf_sprintf("operator not allowed for type '%s'", buf_ptr(&resolved_type->name))); |
| 5561 | 5563 | return ira->codegen->builtin_types.entry_invalid; |
| 5562 | 5564 | |
| ... | ... | @@ -5741,7 +5743,7 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 5741 | 5743 | // float |
| 5742 | 5744 | } else { |
| 5743 | 5745 | AstNode *source_node = bin_op_instruction->base.source_node; |
| 5744 | | add_node_error(ira->codegen, source_node, |
| 5746 | ir_add_error_node(ira, source_node, |
| 5745 | 5747 | buf_sprintf("invalid operands to binary expression: '%s' and '%s'", |
| 5746 | 5748 | buf_ptr(&op1->type_entry->name), |
| 5747 | 5749 | buf_ptr(&op2->type_entry->name))); |
| ... | ... | @@ -5767,11 +5769,11 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 5767 | 5769 | int err; |
| 5768 | 5770 | if ((err = ir_eval_math_op(op1_val, resolved_type, op_id, op2_val, resolved_type, out_val))) { |
| 5769 | 5771 | if (err == ErrorDivByZero) { |
| 5770 | | add_node_error(ira->codegen, bin_op_instruction->base.source_node, |
| 5772 | ir_add_error_node(ira, bin_op_instruction->base.source_node, |
| 5771 | 5773 | buf_sprintf("division by zero is undefined")); |
| 5772 | 5774 | return ira->codegen->builtin_types.entry_invalid; |
| 5773 | 5775 | } else if (err == ErrorOverflow) { |
| 5774 | | add_node_error(ira->codegen, bin_op_instruction->base.source_node, |
| 5776 | ir_add_error_node(ira, bin_op_instruction->base.source_node, |
| 5775 | 5777 | buf_sprintf("value cannot be represented in any integer type")); |
| 5776 | 5778 | return ira->codegen->builtin_types.entry_invalid; |
| 5777 | 5779 | } |
| ... | ... | @@ -6037,7 +6039,7 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 6037 | 6039 | case TypeTableEntryIdNumLitFloat: |
| 6038 | 6040 | case TypeTableEntryIdNumLitInt: |
| 6039 | 6041 | if (is_export || is_extern || casted_init_value->static_value.special == ConstValSpecialRuntime) { |
| 6040 | | add_node_error(ira->codegen, source_node, buf_sprintf("unable to infer variable type")); |
| 6042 | ir_add_error_node(ira, source_node, buf_sprintf("unable to infer variable type")); |
| 6041 | 6043 | result_type = ira->codegen->builtin_types.entry_invalid; |
| 6042 | 6044 | } |
| 6043 | 6045 | break; |
| ... | ... | @@ -6045,14 +6047,14 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 6045 | 6047 | case TypeTableEntryIdVar: |
| 6046 | 6048 | case TypeTableEntryIdBlock: |
| 6047 | 6049 | case TypeTableEntryIdNullLit: |
| 6048 | | add_node_error(ira->codegen, source_node, |
| 6050 | ir_add_error_node(ira, source_node, |
| 6049 | 6051 | buf_sprintf("variable of type '%s' not allowed", buf_ptr(&result_type->name))); |
| 6050 | 6052 | result_type = ira->codegen->builtin_types.entry_invalid; |
| 6051 | 6053 | break; |
| 6052 | 6054 | case TypeTableEntryIdMetaType: |
| 6053 | 6055 | case TypeTableEntryIdNamespace: |
| 6054 | 6056 | if (casted_init_value->static_value.special == ConstValSpecialRuntime) { |
| 6055 | | add_node_error(ira->codegen, source_node, |
| 6057 | ir_add_error_node(ira, source_node, |
| 6056 | 6058 | buf_sprintf("variable of type '%s' must be constant", buf_ptr(&result_type->name))); |
| 6057 | 6059 | result_type = ira->codegen->builtin_types.entry_invalid; |
| 6058 | 6060 | } |
| ... | ... | @@ -6212,7 +6214,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 6212 | 6214 | |
| 6213 | 6215 | if (fn_type_id->is_var_args) { |
| 6214 | 6216 | if (call_param_count < src_param_count) { |
| 6215 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 6217 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 6216 | 6218 | buf_sprintf("expected at least %zu arguments, found %zu", src_param_count, call_param_count)); |
| 6217 | 6219 | if (fn_proto_node) { |
| 6218 | 6220 | add_error_note(ira->codegen, msg, fn_proto_node, |
| ... | ... | @@ -6221,7 +6223,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 6221 | 6223 | return ira->codegen->builtin_types.entry_invalid; |
| 6222 | 6224 | } |
| 6223 | 6225 | } else if (src_param_count != call_param_count) { |
| 6224 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 6226 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 6225 | 6227 | buf_sprintf("expected %zu arguments, found %zu", src_param_count, call_param_count)); |
| 6226 | 6228 | if (fn_proto_node) { |
| 6227 | 6229 | add_error_note(ira->codegen, msg, fn_proto_node, |
| ... | ... | @@ -6446,7 +6448,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 6446 | 6448 | size_t actual_param_count = call_instruction->arg_count; |
| 6447 | 6449 | |
| 6448 | 6450 | if (actual_param_count != 1) { |
| 6449 | | add_node_error(ira->codegen, call_instruction->base.source_node, |
| 6451 | ir_add_error_node(ira, call_instruction->base.source_node, |
| 6450 | 6452 | buf_sprintf("cast expression expects exactly one parameter")); |
| 6451 | 6453 | return ira->codegen->builtin_types.entry_invalid; |
| 6452 | 6454 | } |
| ... | ... | @@ -6470,7 +6472,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 6470 | 6472 | return ir_analyze_fn_call(ira, call_instruction, fn_table_entry, fn_table_entry->type_entry, |
| 6471 | 6473 | nullptr, first_arg_ptr, is_inline); |
| 6472 | 6474 | } else { |
| 6473 | | add_node_error(ira->codegen, fn_ref->source_node, |
| 6475 | ir_add_error_node(ira, fn_ref->source_node, |
| 6474 | 6476 | buf_sprintf("type '%s' not a function", buf_ptr(&fn_ref->type_entry->name))); |
| 6475 | 6477 | return ira->codegen->builtin_types.entry_invalid; |
| 6476 | 6478 | } |
| ... | ... | @@ -6480,7 +6482,7 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 6480 | 6482 | return ir_analyze_fn_call(ira, call_instruction, nullptr, fn_ref->type_entry, |
| 6481 | 6483 | fn_ref, nullptr, false); |
| 6482 | 6484 | } else { |
| 6483 | | add_node_error(ira->codegen, fn_ref->source_node, |
| 6485 | ir_add_error_node(ira, fn_ref->source_node, |
| 6484 | 6486 | buf_sprintf("type '%s' not a function", buf_ptr(&fn_ref->type_entry->name))); |
| 6485 | 6487 | return ira->codegen->builtin_types.entry_invalid; |
| 6486 | 6488 | } |
| ... | ... | @@ -6531,7 +6533,7 @@ static TypeTableEntry *ir_analyze_unary_prefix_op_err(IrAnalyze *ira, IrInstruct |
| 6531 | 6533 | case TypeTableEntryIdBlock: |
| 6532 | 6534 | case TypeTableEntryIdUnreachable: |
| 6533 | 6535 | case TypeTableEntryIdVar: |
| 6534 | | add_node_error(ira->codegen, un_op_instruction->base.source_node, |
| 6536 | ir_add_error_node(ira, un_op_instruction->base.source_node, |
| 6535 | 6537 | buf_sprintf("unable to wrap type '%s' in error type", buf_ptr(&meta_type->name))); |
| 6536 | 6538 | // TODO if meta_type is type decl, add note pointing to type decl declaration |
| 6537 | 6539 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -6550,7 +6552,7 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp |
| 6550 | 6552 | } else if (ptr_type->id == TypeTableEntryIdPointer) { |
| 6551 | 6553 | child_type = ptr_type->data.pointer.child_type; |
| 6552 | 6554 | } else { |
| 6553 | | add_node_error(ira->codegen, un_op_instruction->base.source_node, |
| 6555 | ir_add_error_node(ira, un_op_instruction->base.source_node, |
| 6554 | 6556 | buf_sprintf("attempt to dereference non-pointer type '%s'", |
| 6555 | 6557 | buf_ptr(&ptr_type->name))); |
| 6556 | 6558 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -6608,7 +6610,7 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op |
| 6608 | 6610 | return ira->codegen->builtin_types.entry_type; |
| 6609 | 6611 | } |
| 6610 | 6612 | case TypeTableEntryIdUnreachable: |
| 6611 | | add_node_error(ira->codegen, un_op_instruction->base.source_node, |
| 6613 | ir_add_error_node(ira, un_op_instruction->base.source_node, |
| 6612 | 6614 | buf_sprintf("type '%s' not nullable", buf_ptr(&type_entry->name))); |
| 6613 | 6615 | // TODO if it's a type decl, put an error note here pointing to the decl |
| 6614 | 6616 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -6813,7 +6815,7 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP |
| 6813 | 6815 | if (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| 6814 | 6816 | resolved_type->id == TypeTableEntryIdNumLitInt) |
| 6815 | 6817 | { |
| 6816 | | add_node_error(ira->codegen, phi_instruction->base.source_node, |
| 6818 | ir_add_error_node(ira, phi_instruction->base.source_node, |
| 6817 | 6819 | buf_sprintf("unable to infer expression type")); |
| 6818 | 6820 | return ira->codegen->builtin_types.entry_invalid; |
| 6819 | 6821 | } |
| ... | ... | @@ -6891,7 +6893,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 6891 | 6893 | return array_type; |
| 6892 | 6894 | } else if (array_type->id == TypeTableEntryIdArray) { |
| 6893 | 6895 | if (array_type->data.array.len == 0) { |
| 6894 | | add_node_error(ira->codegen, elem_ptr_instruction->base.source_node, |
| 6896 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 6895 | 6897 | buf_sprintf("index 0 outside array of size 0")); |
| 6896 | 6898 | } |
| 6897 | 6899 | TypeTableEntry *child_type = array_type->data.array.child_type; |
| ... | ... | @@ -6901,7 +6903,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 6901 | 6903 | } else if (is_slice(array_type)) { |
| 6902 | 6904 | return_type = array_type->data.structure.fields[0].type_entry; |
| 6903 | 6905 | } else { |
| 6904 | | add_node_error(ira->codegen, elem_ptr_instruction->base.source_node, |
| 6906 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 6905 | 6907 | buf_sprintf("array access of non-array type '%s'", buf_ptr(&array_type->name))); |
| 6906 | 6908 | return ira->codegen->builtin_types.entry_invalid; |
| 6907 | 6909 | } |
| ... | ... | @@ -6917,7 +6919,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 6917 | 6919 | if (array_type->id == TypeTableEntryIdArray) { |
| 6918 | 6920 | uint64_t array_len = array_type->data.array.len; |
| 6919 | 6921 | if (index >= array_len) { |
| 6920 | | add_node_error(ira->codegen, elem_ptr_instruction->base.source_node, |
| 6922 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 6921 | 6923 | buf_sprintf("index %" PRIu64 " outside array of size %" PRIu64, |
| 6922 | 6924 | index, array_len)); |
| 6923 | 6925 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -6948,7 +6950,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 6948 | 6950 | old_size = mem_size - offset; |
| 6949 | 6951 | } |
| 6950 | 6952 | if (new_index >= mem_size) { |
| 6951 | | add_node_error(ira->codegen, elem_ptr_instruction->base.source_node, |
| 6953 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 6952 | 6954 | buf_sprintf("index %" PRIu64 " outside pointer of size %" PRIu64, index, old_size)); |
| 6953 | 6955 | return ira->codegen->builtin_types.entry_invalid; |
| 6954 | 6956 | } |
| ... | ... | @@ -6959,7 +6961,7 @@ static TypeTableEntry *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruc |
| 6959 | 6961 | ConstExprValue *len_field = &array_ptr_val->data.x_struct.fields[slice_len_index]; |
| 6960 | 6962 | uint64_t slice_len = len_field->data.x_bignum.data.x_uint; |
| 6961 | 6963 | if (index >= slice_len) { |
| 6962 | | add_node_error(ira->codegen, elem_ptr_instruction->base.source_node, |
| 6964 | ir_add_error_node(ira, elem_ptr_instruction->base.source_node, |
| 6963 | 6965 | buf_sprintf("index %" PRIu64 " outside slice of size %" PRIu64, |
| 6964 | 6966 | index, slice_len)); |
| 6965 | 6967 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7009,7 +7011,7 @@ static TypeTableEntry *ir_analyze_container_member_access_inner(IrAnalyze *ira, |
| 7009 | 7011 | return ir_analyze_ref(ira, &field_ptr_instruction->base, bound_fn_value); |
| 7010 | 7012 | } |
| 7011 | 7013 | } |
| 7012 | | add_node_error(ira->codegen, field_ptr_instruction->base.source_node, |
| 7014 | ir_add_error_node(ira, field_ptr_instruction->base.source_node, |
| 7013 | 7015 | buf_sprintf("no member named '%s' in '%s'", buf_ptr(field_name), buf_ptr(&bare_struct_type->name))); |
| 7014 | 7016 | return ira->codegen->builtin_types.entry_invalid; |
| 7015 | 7017 | } |
| ... | ... | @@ -7138,7 +7140,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 7138 | 7140 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, len_val, |
| 7139 | 7141 | usize, false, ConstPtrSpecialNone, ptr_is_const); |
| 7140 | 7142 | } else { |
| 7141 | | add_node_error(ira->codegen, source_node, |
| 7143 | ir_add_error_node(ira, source_node, |
| 7142 | 7144 | buf_sprintf("no member named '%s' in '%s'", buf_ptr(field_name), |
| 7143 | 7145 | buf_ptr(&container_type->name))); |
| 7144 | 7146 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7253,7 +7255,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 7253 | 7255 | if (tld->visib_mod == VisibModPrivate && |
| 7254 | 7256 | tld->import != source_node->owner) |
| 7255 | 7257 | { |
| 7256 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 7258 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 7257 | 7259 | buf_sprintf("'%s' is private", buf_ptr(field_name))); |
| 7258 | 7260 | add_error_note(ira->codegen, msg, tld->source_node, buf_sprintf("declared here")); |
| 7259 | 7261 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7261,12 +7263,12 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 7261 | 7263 | return ir_analyze_decl_ref(ira, &field_ptr_instruction->base, tld, depends_on_compile_var); |
| 7262 | 7264 | } else { |
| 7263 | 7265 | const char *import_name = namespace_import->path ? buf_ptr(namespace_import->path) : "(C import)"; |
| 7264 | | add_node_error(ira->codegen, source_node, |
| 7266 | ir_add_error_node(ira, source_node, |
| 7265 | 7267 | buf_sprintf("no member named '%s' in '%s'", buf_ptr(field_name), import_name)); |
| 7266 | 7268 | return ira->codegen->builtin_types.entry_invalid; |
| 7267 | 7269 | } |
| 7268 | 7270 | } else { |
| 7269 | | add_node_error(ira->codegen, field_ptr_instruction->base.source_node, |
| 7271 | ir_add_error_node(ira, field_ptr_instruction->base.source_node, |
| 7270 | 7272 | buf_sprintf("type '%s' does not support field access", buf_ptr(&container_type->name))); |
| 7271 | 7273 | return ira->codegen->builtin_types.entry_invalid; |
| 7272 | 7274 | } |
| ... | ... | @@ -7348,7 +7350,7 @@ static TypeTableEntry *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructi |
| 7348 | 7350 | case TypeTableEntryIdInvalid: |
| 7349 | 7351 | return type_entry; |
| 7350 | 7352 | case TypeTableEntryIdVar: |
| 7351 | | add_node_error(ira->codegen, expr_value->source_node, |
| 7353 | ir_add_error_node(ira, expr_value->source_node, |
| 7352 | 7354 | buf_sprintf("type '%s' not eligible for @typeOf", buf_ptr(&type_entry->name))); |
| 7353 | 7355 | return ira->codegen->builtin_types.entry_invalid; |
| 7354 | 7356 | case TypeTableEntryIdNumLitFloat: |
| ... | ... | @@ -7402,7 +7404,7 @@ static TypeTableEntry *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira, |
| 7402 | 7404 | } else if (is_slice(type_entry)) { |
| 7403 | 7405 | ptr_type = type_entry->data.structure.fields[0].type_entry; |
| 7404 | 7406 | } else { |
| 7405 | | add_node_error(ira->codegen, to_ptr_type_instruction->base.source_node, |
| 7407 | ir_add_error_node(ira, to_ptr_type_instruction->base.source_node, |
| 7406 | 7408 | buf_sprintf("expected array type, found '%s'", buf_ptr(&type_entry->name))); |
| 7407 | 7409 | return ira->codegen->builtin_types.entry_invalid; |
| 7408 | 7410 | } |
| ... | ... | @@ -7423,7 +7425,7 @@ static TypeTableEntry *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira, |
| 7423 | 7425 | |
| 7424 | 7426 | // TODO handle typedefs |
| 7425 | 7427 | if (type_entry->id != TypeTableEntryIdPointer) { |
| 7426 | | add_node_error(ira->codegen, ptr_type_child_instruction->base.source_node, |
| 7428 | ir_add_error_node(ira, ptr_type_child_instruction->base.source_node, |
| 7427 | 7429 | buf_sprintf("expected pointer type, found '%s'", buf_ptr(&type_entry->name))); |
| 7428 | 7430 | return ira->codegen->builtin_types.entry_invalid; |
| 7429 | 7431 | } |
| ... | ... | @@ -7468,7 +7470,7 @@ static TypeTableEntry *ir_analyze_instruction_set_fn_visible(IrAnalyze *ira, |
| 7468 | 7470 | |
| 7469 | 7471 | AstNode *source_node = set_fn_visible_instruction->base.source_node; |
| 7470 | 7472 | if (fn_entry->fn_export_set_node) { |
| 7471 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 7473 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 7472 | 7474 | buf_sprintf("function visibility set twice")); |
| 7473 | 7475 | add_error_note(ira->codegen, msg, fn_entry->fn_export_set_node, buf_sprintf("first set here")); |
| 7474 | 7476 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7477,7 +7479,7 @@ static TypeTableEntry *ir_analyze_instruction_set_fn_visible(IrAnalyze *ira, |
| 7477 | 7479 | |
| 7478 | 7480 | AstNodeFnProto *fn_proto = &fn_entry->proto_node->data.fn_proto; |
| 7479 | 7481 | if (fn_proto->visib_mod != VisibModExport) { |
| 7480 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 7482 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 7481 | 7483 | buf_sprintf("function must be marked export to set function visibility")); |
| 7482 | 7484 | add_error_note(ira->codegen, msg, fn_entry->proto_node, buf_sprintf("function declared here")); |
| 7483 | 7485 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7520,14 +7522,14 @@ static TypeTableEntry *ir_analyze_instruction_set_debug_safety(IrAnalyze *ira, |
| 7520 | 7522 | } else if (type_arg->id == TypeTableEntryIdUnion) { |
| 7521 | 7523 | decls_scope = type_arg->data.unionation.decls_scope; |
| 7522 | 7524 | } else { |
| 7523 | | add_node_error(ira->codegen, target_instruction->source_node, |
| 7525 | ir_add_error_node(ira, target_instruction->source_node, |
| 7524 | 7526 | buf_sprintf("expected scope reference, found type '%s'", buf_ptr(&type_arg->name))); |
| 7525 | 7527 | return ira->codegen->builtin_types.entry_invalid; |
| 7526 | 7528 | } |
| 7527 | 7529 | safety_off_ptr = &decls_scope->safety_off; |
| 7528 | 7530 | safety_set_node_ptr = &decls_scope->safety_set_node; |
| 7529 | 7531 | } else { |
| 7530 | | add_node_error(ira->codegen, target_instruction->source_node, |
| 7532 | ir_add_error_node(ira, target_instruction->source_node, |
| 7531 | 7533 | buf_sprintf("expected scope reference, found type '%s'", buf_ptr(&target_type->name))); |
| 7532 | 7534 | return ira->codegen->builtin_types.entry_invalid; |
| 7533 | 7535 | } |
| ... | ... | @@ -7539,7 +7541,7 @@ static TypeTableEntry *ir_analyze_instruction_set_debug_safety(IrAnalyze *ira, |
| 7539 | 7541 | |
| 7540 | 7542 | AstNode *source_node = set_debug_safety_instruction->base.source_node; |
| 7541 | 7543 | if (*safety_set_node_ptr) { |
| 7542 | | ErrorMsg *msg = add_node_error(ira->codegen, source_node, |
| 7544 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
| 7543 | 7545 | buf_sprintf("function test attribute set twice")); |
| 7544 | 7546 | add_error_note(ira->codegen, msg, *safety_set_node_ptr, buf_sprintf("first set here")); |
| 7545 | 7547 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7571,7 +7573,7 @@ static TypeTableEntry *ir_analyze_instruction_slice_type(IrAnalyze *ira, |
| 7571 | 7573 | case TypeTableEntryIdUndefLit: |
| 7572 | 7574 | case TypeTableEntryIdNullLit: |
| 7573 | 7575 | case TypeTableEntryIdBlock: |
| 7574 | | add_node_error(ira->codegen, slice_type_instruction->base.source_node, |
| 7576 | ir_add_error_node(ira, slice_type_instruction->base.source_node, |
| 7575 | 7577 | buf_sprintf("slice of type '%s' not allowed", buf_ptr(&resolved_child_type->name))); |
| 7576 | 7578 | // TODO if this is a typedecl, add error note showing the declaration of the type decl |
| 7577 | 7579 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7660,7 +7662,7 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira, |
| 7660 | 7662 | case TypeTableEntryIdUndefLit: |
| 7661 | 7663 | case TypeTableEntryIdNullLit: |
| 7662 | 7664 | case TypeTableEntryIdBlock: |
| 7663 | | add_node_error(ira->codegen, array_type_instruction->base.source_node, |
| 7665 | ir_add_error_node(ira, array_type_instruction->base.source_node, |
| 7664 | 7666 | buf_sprintf("array of type '%s' not allowed", buf_ptr(&child_type->name))); |
| 7665 | 7667 | // TODO if this is a typedecl, add error note showing the declaration of the type decl |
| 7666 | 7668 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7726,7 +7728,7 @@ static TypeTableEntry *ir_analyze_instruction_compile_var(IrAnalyze *ira, |
| 7726 | 7728 | out_val->data.x_enum.tag = ira->codegen->target_oformat_index; |
| 7727 | 7729 | return ira->codegen->builtin_types.entry_oformat_enum; |
| 7728 | 7730 | } else { |
| 7729 | | add_node_error(ira->codegen, name_value->source_node, |
| 7731 | ir_add_error_node(ira, name_value->source_node, |
| 7730 | 7732 | buf_sprintf("unrecognized compile variable: '%s'", buf_ptr(var_name))); |
| 7731 | 7733 | return ira->codegen->builtin_types.entry_invalid; |
| 7732 | 7734 | } |
| ... | ... | @@ -7755,7 +7757,7 @@ static TypeTableEntry *ir_analyze_instruction_size_of(IrAnalyze *ira, |
| 7755 | 7757 | case TypeTableEntryIdMetaType: |
| 7756 | 7758 | case TypeTableEntryIdFn: |
| 7757 | 7759 | case TypeTableEntryIdNamespace: |
| 7758 | | add_node_error(ira->codegen, size_of_instruction->base.source_node, |
| 7760 | ir_add_error_node(ira, size_of_instruction->base.source_node, |
| 7759 | 7761 | buf_sprintf("no size available for type '%s'", buf_ptr(&type_entry->name))); |
| 7760 | 7762 | // TODO if this is a typedecl, add error note showing the declaration of the type decl |
| 7761 | 7763 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -7831,7 +7833,7 @@ static TypeTableEntry *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira, |
| 7831 | 7833 | if (type_entry->id == TypeTableEntryIdInvalid) { |
| 7832 | 7834 | return ira->codegen->builtin_types.entry_invalid; |
| 7833 | 7835 | } else if (type_entry->id != TypeTableEntryIdMaybe) { |
| 7834 | | add_node_error(ira->codegen, unwrap_maybe_instruction->base.source_node, |
| 7836 | ir_add_error_node(ira, unwrap_maybe_instruction->base.source_node, |
| 7835 | 7837 | buf_sprintf("expected nullable type, found '%s'", buf_ptr(&type_entry->name))); |
| 7836 | 7838 | return ira->codegen->builtin_types.entry_invalid; |
| 7837 | 7839 | } |
| ... | ... | @@ -7882,7 +7884,7 @@ static TypeTableEntry *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionC |
| 7882 | 7884 | ir_build_ctz_from(&ira->new_irb, &ctz_instruction->base, value); |
| 7883 | 7885 | return value->type_entry; |
| 7884 | 7886 | } else { |
| 7885 | | add_node_error(ira->codegen, ctz_instruction->base.source_node, |
| 7887 | ir_add_error_node(ira, ctz_instruction->base.source_node, |
| 7886 | 7888 | buf_sprintf("expected integer type, found '%s'", buf_ptr(&value->type_entry->name))); |
| 7887 | 7889 | return ira->codegen->builtin_types.entry_invalid; |
| 7888 | 7890 | } |
| ... | ... | @@ -7906,7 +7908,7 @@ static TypeTableEntry *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionC |
| 7906 | 7908 | ir_build_clz_from(&ira->new_irb, &clz_instruction->base, value); |
| 7907 | 7909 | return value->type_entry; |
| 7908 | 7910 | } else { |
| 7909 | | add_node_error(ira->codegen, clz_instruction->base.source_node, |
| 7911 | ir_add_error_node(ira, clz_instruction->base.source_node, |
| 7910 | 7912 | buf_sprintf("expected integer type, found '%s'", buf_ptr(&value->type_entry->name))); |
| 7911 | 7913 | return ira->codegen->builtin_types.entry_invalid; |
| 7912 | 7914 | } |
| ... | ... | @@ -8095,7 +8097,7 @@ static TypeTableEntry *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 8095 | 8097 | case TypeTableEntryIdUnion: |
| 8096 | 8098 | case TypeTableEntryIdBlock: |
| 8097 | 8099 | case TypeTableEntryIdBoundFn: |
| 8098 | | add_node_error(ira->codegen, switch_target_instruction->base.source_node, |
| 8100 | ir_add_error_node(ira, switch_target_instruction->base.source_node, |
| 8099 | 8101 | buf_sprintf("invalid switch target type '%s'", buf_ptr(&target_type->name))); |
| 8100 | 8102 | // TODO if this is a typedecl, add error note showing the declaration of the type decl |
| 8101 | 8103 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -8166,12 +8168,12 @@ static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructi |
| 8166 | 8168 | int err; |
| 8167 | 8169 | if ((err = os_path_real(&full_path, abs_full_path))) { |
| 8168 | 8170 | if (err == ErrorFileNotFound) { |
| 8169 | | add_node_error(ira->codegen, source_node, |
| 8171 | ir_add_error_node(ira, source_node, |
| 8170 | 8172 | buf_sprintf("unable to find '%s'", buf_ptr(import_target_path))); |
| 8171 | 8173 | return ira->codegen->builtin_types.entry_invalid; |
| 8172 | 8174 | } else { |
| 8173 | 8175 | ira->codegen->error_during_imports = true; |
| 8174 | | add_node_error(ira->codegen, source_node, |
| 8176 | ir_add_error_node(ira, source_node, |
| 8175 | 8177 | buf_sprintf("unable to open '%s': %s", buf_ptr(&full_path), err_str(err))); |
| 8176 | 8178 | return ira->codegen->builtin_types.entry_invalid; |
| 8177 | 8179 | } |
| ... | ... | @@ -8186,11 +8188,11 @@ static TypeTableEntry *ir_analyze_instruction_import(IrAnalyze *ira, IrInstructi |
| 8186 | 8188 | |
| 8187 | 8189 | if ((err = os_fetch_file_path(abs_full_path, import_code))) { |
| 8188 | 8190 | if (err == ErrorFileNotFound) { |
| 8189 | | add_node_error(ira->codegen, source_node, |
| 8191 | ir_add_error_node(ira, source_node, |
| 8190 | 8192 | buf_sprintf("unable to find '%s'", buf_ptr(import_target_path))); |
| 8191 | 8193 | return ira->codegen->builtin_types.entry_invalid; |
| 8192 | 8194 | } else { |
| 8193 | | add_node_error(ira->codegen, source_node, |
| 8195 | ir_add_error_node(ira, source_node, |
| 8194 | 8196 | buf_sprintf("unable to open '%s': %s", buf_ptr(&full_path), err_str(err))); |
| 8195 | 8197 | return ira->codegen->builtin_types.entry_invalid; |
| 8196 | 8198 | } |
| ... | ... | @@ -8233,7 +8235,7 @@ static TypeTableEntry *ir_analyze_instruction_array_len(IrAnalyze *ira, |
| 8233 | 8235 | ir_build_load_ptr_from(&ira->new_irb, &array_len_instruction->base, len_ptr); |
| 8234 | 8236 | return ira->codegen->builtin_types.entry_usize; |
| 8235 | 8237 | } else { |
| 8236 | | add_node_error(ira->codegen, array_len_instruction->base.source_node, |
| 8238 | ir_add_error_node(ira, array_len_instruction->base.source_node, |
| 8237 | 8239 | buf_sprintf("type '%s' has no field 'len'", buf_ptr(&array_value->type_entry->name))); |
| 8238 | 8240 | // TODO if this is a typedecl, add error note showing the declaration of the type decl |
| 8239 | 8241 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -8276,7 +8278,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 8276 | 8278 | |
| 8277 | 8279 | TypeStructField *type_field = find_struct_type_field(container_type, field->name); |
| 8278 | 8280 | if (!type_field) { |
| 8279 | | add_node_error(ira->codegen, field->source_node, |
| 8281 | ir_add_error_node(ira, field->source_node, |
| 8280 | 8282 | buf_sprintf("no member named '%s' in '%s'", |
| 8281 | 8283 | buf_ptr(field->name), buf_ptr(&container_type->name))); |
| 8282 | 8284 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -8288,7 +8290,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 8288 | 8290 | size_t field_index = type_field->src_index; |
| 8289 | 8291 | AstNode *existing_assign_node = field_assign_nodes[field_index]; |
| 8290 | 8292 | if (existing_assign_node) { |
| 8291 | | ErrorMsg *msg = add_node_error(ira->codegen, field->source_node, buf_sprintf("duplicate field")); |
| 8293 | ErrorMsg *msg = ir_add_error_node(ira, field->source_node, buf_sprintf("duplicate field")); |
| 8292 | 8294 | add_error_note(ira->codegen, msg, existing_assign_node, buf_sprintf("other field here")); |
| 8293 | 8295 | continue; |
| 8294 | 8296 | } |
| ... | ... | @@ -8315,7 +8317,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 8315 | 8317 | bool any_missing = false; |
| 8316 | 8318 | for (size_t i = 0; i < actual_field_count; i += 1) { |
| 8317 | 8319 | if (!field_assign_nodes[i]) { |
| 8318 | | add_node_error(ira->codegen, instruction->source_node, |
| 8320 | ir_add_error_node(ira, instruction->source_node, |
| 8319 | 8321 | buf_sprintf("missing field: '%s'", buf_ptr(container_type->data.structure.fields[i].name))); |
| 8320 | 8322 | any_missing = true; |
| 8321 | 8323 | } |
| ... | ... | @@ -8330,7 +8332,7 @@ static TypeTableEntry *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstru |
| 8330 | 8332 | } |
| 8331 | 8333 | |
| 8332 | 8334 | if (outside_fn) { |
| 8333 | | add_node_error(ira->codegen, first_non_const_instruction->source_node, |
| 8335 | ir_add_error_node(ira, first_non_const_instruction->source_node, |
| 8334 | 8336 | buf_sprintf("unable to evaluate constant expression")); |
| 8335 | 8337 | return ira->codegen->builtin_types.entry_invalid; |
| 8336 | 8338 | } |
| ... | ... | @@ -8401,7 +8403,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 8401 | 8403 | } |
| 8402 | 8404 | |
| 8403 | 8405 | if (outside_fn) { |
| 8404 | | add_node_error(ira->codegen, first_non_const_instruction->source_node, |
| 8406 | ir_add_error_node(ira, first_non_const_instruction->source_node, |
| 8405 | 8407 | buf_sprintf("unable to evaluate constant expression")); |
| 8406 | 8408 | return ira->codegen->builtin_types.entry_invalid; |
| 8407 | 8409 | } |
| ... | ... | @@ -8415,13 +8417,13 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 8415 | 8417 | zig_panic("TODO array container init"); |
| 8416 | 8418 | } else if (container_type->id == TypeTableEntryIdVoid) { |
| 8417 | 8419 | if (elem_count != 0) { |
| 8418 | | add_node_error(ira->codegen, instruction->base.source_node, |
| 8420 | ir_add_error_node(ira, instruction->base.source_node, |
| 8419 | 8421 | buf_sprintf("void expression expects no arguments")); |
| 8420 | 8422 | return ira->codegen->builtin_types.entry_invalid; |
| 8421 | 8423 | } |
| 8422 | 8424 | return ir_analyze_void(ira, &instruction->base); |
| 8423 | 8425 | } else { |
| 8424 | | add_node_error(ira->codegen, instruction->base.source_node, |
| 8426 | ir_add_error_node(ira, instruction->base.source_node, |
| 8425 | 8427 | buf_sprintf("type '%s' does not support array initialization", |
| 8426 | 8428 | buf_ptr(&container_type->name))); |
| 8427 | 8429 | return ira->codegen->builtin_types.entry_invalid; |
| ... | ... | @@ -8594,7 +8596,7 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 8594 | 8596 | } |
| 8595 | 8597 | |
| 8596 | 8598 | if (errors.length > 0) { |
| 8597 | | ErrorMsg *parent_err_msg = add_node_error(ira->codegen, node, buf_sprintf("C import failed")); |
| 8599 | ErrorMsg *parent_err_msg = ir_add_error_node(ira, node, buf_sprintf("C import failed")); |
| 8598 | 8600 | for (size_t i = 0; i < errors.length; i += 1) { |
| 8599 | 8601 | ErrorMsg *err_msg = errors.at(i); |
| 8600 | 8602 | err_msg_add_note(parent_err_msg, err_msg); |
| ... | ... | @@ -9380,7 +9382,7 @@ static TypeTableEntry *ir_analyze_instruction_alignof(IrAnalyze *ira, IrInstruct |
| 9380 | 9382 | if (type_entry->id == TypeTableEntryIdInvalid) { |
| 9381 | 9383 | return ira->codegen->builtin_types.entry_invalid; |
| 9382 | 9384 | } else if (type_entry->id == TypeTableEntryIdUnreachable) { |
| 9383 | | add_node_error(ira->codegen, first_executing_node(instruction->type_value->source_node), |
| 9385 | ir_add_error(ira, instruction->type_value, |
| 9384 | 9386 | buf_sprintf("no align available for type '%s'", buf_ptr(&type_entry->name))); |
| 9385 | 9387 | return ira->codegen->builtin_types.entry_invalid; |
| 9386 | 9388 | } else { |