authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-28 13:25:49-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-28 13:25:49-05:00
log86da9346e4839007931f811fd34498d8209baed0
tree5884ebe02295df6b8b65d7b5a47b359159f4fd29
parente0000c47bd22c7b351247b72a85ca26c1c2ada96
signature Commit is signed but in an unrecognized format.

fix error message column/line number regressions


1 files changed, 15 insertions(+), 15 deletions(-)

src/ir.cpp+15-15
......@@ -232,7 +232,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ZigValue *val)
232232static Error ir_read_const_ptr(IrAnalyze *ira, CodeGen *codegen, AstNode *source_node,
233233 ZigValue *out_val, ZigValue *ptr_val);
234234static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrInstGen *ptr,
235 ZigType *dest_type, IrInst *dest_type_src, bool safety_check_on);
235 IrInst *ptr_src, ZigType *dest_type, IrInst *dest_type_src, bool safety_check_on);
236236static ZigValue *ir_resolve_const(IrAnalyze *ira, IrInstGen *value, UndefAllowed undef_allowed);
237237static Error resolve_ptr_align(IrAnalyze *ira, ZigType *ty, uint32_t *result_align);
238238static IrInstGen *ir_analyze_int_to_ptr(IrAnalyze *ira, IrInst* source_instr, IrInstGen *target,
......@@ -14999,7 +14999,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr,
1499914999 dest_ptr_type = wanted_type->data.maybe.child_type;
1500015000 }
1500115001 if (dest_ptr_type != nullptr) {
15002 return ir_analyze_ptr_cast(ira, source_instr, value, wanted_type, source_instr, true);
15002 return ir_analyze_ptr_cast(ira, source_instr, value, source_instr, wanted_type, source_instr, true);
1500315003 }
1500415004 }
1500515005
......@@ -15041,7 +15041,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr,
1504115041 actual_type->data.pointer.child_type, source_node,
1504215042 !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk)
1504315043 {
15044 return ir_analyze_ptr_cast(ira, source_instr, value, wanted_type, source_instr, true);
15044 return ir_analyze_ptr_cast(ira, source_instr, value, source_instr, wanted_type, source_instr, true);
1504515045 }
1504615046
1504715047 // cast from integer to C pointer
......@@ -18478,7 +18478,7 @@ static IrInstGen *ir_resolve_result_raw(IrAnalyze *ira, IrInst *suspend_source_i
1847818478
1847918479 result_loc->written = true;
1848018480 result_loc->resolved_loc = ir_analyze_ptr_cast(ira, suspend_source_instr, parent_result_loc,
18481 ptr_type, &result_cast->base.source_instruction->base, false);
18481 &parent_result_loc->base, ptr_type, &result_cast->base.source_instruction->base, false);
1848218482 return result_loc->resolved_loc;
1848318483 }
1848418484 case ResultLocIdBitCast: {
......@@ -18566,7 +18566,7 @@ static IrInstGen *ir_resolve_result_raw(IrAnalyze *ira, IrInst *suspend_source_i
1856618566
1856718567 result_loc->written = true;
1856818568 result_loc->resolved_loc = ir_analyze_ptr_cast(ira, suspend_source_instr, parent_result_loc,
18569 ptr_type, &result_bit_cast->base.source_instruction->base, false);
18569 &parent_result_loc->base, ptr_type, &result_bit_cast->base.source_instruction->base, false);
1857018570 return result_loc->resolved_loc;
1857118571 }
1857218572 }
......@@ -22716,8 +22716,8 @@ static IrInstGen *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstSrcSwi
2271622716 ref_type->data.pointer.explicit_alignment,
2271722717 ref_type->data.pointer.bit_offset_in_host, ref_type->data.pointer.host_int_bytes,
2271822718 ref_type->data.pointer.allow_zero);
22719 return ir_analyze_ptr_cast(ira, &instruction->base.base, target_value_ptr, new_target_value_ptr_type,
22720 &instruction->base.base, false);
22719 return ir_analyze_ptr_cast(ira, &instruction->base.base, target_value_ptr,
22720 &instruction->target_value_ptr->base, new_target_value_ptr_type, &instruction->base.base, false);
2272122721 } else {
2272222722 ir_add_error(ira, &instruction->base.base,
2272322723 buf_sprintf("switch on type '%s' provides no expression parameter", buf_ptr(&target_type->name)));
......@@ -22797,8 +22797,8 @@ static IrInstGen *ir_analyze_instruction_switch_else_var(IrAnalyze *ira,
2279722797 ref_type->data.pointer.explicit_alignment,
2279822798 ref_type->data.pointer.bit_offset_in_host, ref_type->data.pointer.host_int_bytes,
2279922799 ref_type->data.pointer.allow_zero);
22800 return ir_analyze_ptr_cast(ira, &instruction->base.base, target_value_ptr, new_target_value_ptr_type,
22801 &instruction->base.base, false);
22800 return ir_analyze_ptr_cast(ira, &instruction->base.base, target_value_ptr,
22801 &instruction->target_value_ptr->base, new_target_value_ptr_type, &instruction->base.base, false);
2280222802 }
2280322803
2280422804 return target_value_ptr;
......@@ -27688,7 +27688,7 @@ static IrInstGen *ir_align_cast(IrAnalyze *ira, IrInstGen *target, uint32_t alig
2768827688}
2768927689
2769027690static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrInstGen *ptr,
27691 ZigType *dest_type, IrInst *dest_type_src, bool safety_check_on)
27691 IrInst *ptr_src, ZigType *dest_type, IrInst *dest_type_src, bool safety_check_on)
2769227692{
2769327693 Error err;
2769427694
......@@ -27704,7 +27704,7 @@ static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrIn
2770427704
2770527705 ZigType *src_ptr_type = get_src_ptr_type(src_type);
2770627706 if (src_ptr_type == nullptr) {
27707 ir_add_error(ira, &ptr->base, buf_sprintf("expected pointer, found '%s'", buf_ptr(&src_type->name)));
27707 ir_add_error(ira, ptr_src, buf_sprintf("expected pointer, found '%s'", buf_ptr(&src_type->name)));
2770827708 return ira->codegen->invalid_inst_gen;
2770927709 }
2771027710
......@@ -27737,7 +27737,7 @@ static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrIn
2773727737 ErrorMsg *msg = ir_add_error(ira, source_instr,
2773827738 buf_sprintf("'%s' and '%s' do not have the same in-memory representation",
2773927739 buf_ptr(&src_type->name), buf_ptr(&dest_type->name)));
27740 add_error_note(ira->codegen, msg, ptr->base.source_node,
27740 add_error_note(ira->codegen, msg, ptr_src->source_node,
2774127741 buf_sprintf("'%s' has no in-memory bits", buf_ptr(&src_type->name)));
2774227742 add_error_note(ira->codegen, msg, dest_type_src->source_node,
2774327743 buf_sprintf("'%s' has in-memory bits", buf_ptr(&dest_type->name)));
......@@ -27801,7 +27801,7 @@ static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrIn
2780127801
2780227802 if (dest_align_bytes > src_align_bytes) {
2780327803 ErrorMsg *msg = ir_add_error(ira, source_instr, buf_sprintf("cast increases pointer alignment"));
27804 add_error_note(ira->codegen, msg, ptr->base.source_node,
27804 add_error_note(ira->codegen, msg, ptr_src->source_node,
2780527805 buf_sprintf("'%s' has alignment %" PRIu32, buf_ptr(&src_type->name), src_align_bytes));
2780627806 add_error_note(ira->codegen, msg, dest_type_src->source_node,
2780727807 buf_sprintf("'%s' has alignment %" PRIu32, buf_ptr(&dest_type->name), dest_align_bytes));
......@@ -27834,8 +27834,8 @@ static IrInstGen *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstSrcPtrCa
2783427834 if (type_is_invalid(src_type))
2783527835 return ira->codegen->invalid_inst_gen;
2783627836
27837 return ir_analyze_ptr_cast(ira, &instruction->base.base, ptr, dest_type, &dest_type_value->base,
27838 instruction->safety_check_on);
27837 return ir_analyze_ptr_cast(ira, &instruction->base.base, ptr, &instruction->ptr->base,
27838 dest_type, &dest_type_value->base, instruction->safety_check_on);
2783927839}
2784027840
2784127841static void buf_write_value_bytes_array(CodeGen *codegen, uint8_t *buf, ZigValue *val, size_t len) {