authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 15:44:53-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-03 15:44:53-04:00
log735543d502d19152d4f834cc02207a8e4ddc378a
treec099ddcdf65e1947c4746d13981727bc47f61932
parentccce3d852681bfe60bce92a6766b4f431dd73571
signature Commit is signed but in an unrecognized format.

add missing ir_expr_wrap calls


2 files changed, 15 insertions(+), 9 deletions(-)

BRANCH_TODO-2
......@@ -22,5 +22,3 @@ inferred comptime
2222 return ir_build_ref(irb, scope, value->source_node, value, false, false);
2323
2424handle if with no else
25
26audit usage of LVal because that's when ir_lval_wrap is not called which now has build_end_expr
src/ir.cpp+15-7
......@@ -4049,7 +4049,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
40494049 if (lval == LValPtr) {
40504050 return ir_build_ref(irb, scope, node, value, false, false);
40514051 } else {
4052 return value;
4052 return ir_expr_wrap(irb, scope, value, result_loc);
40534053 }
40544054 }
40554055
......@@ -4077,7 +4077,9 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
40774077 return ir_build_undeclared_identifier(irb, scope, node, variable_name);
40784078}
40794079
4080static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval) {
4080static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode *node, LVal lval,
4081 ResultLoc *result_loc)
4082{
40814083 assert(node->type == NodeTypeArrayAccessExpr);
40824084
40834085 AstNode *array_ref_node = node->data.array_access_expr.array_ref_expr;
......@@ -4095,7 +4097,8 @@ static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode
40954097 if (lval == LValPtr)
40964098 return ptr_instruction;
40974099
4098 return ir_build_load_ptr(irb, scope, node, ptr_instruction);
4100 IrInstruction *load_ptr = ir_build_load_ptr(irb, scope, node, ptr_instruction);
4101 return ir_expr_wrap(irb, scope, load_ptr, result_loc);
40994102}
41004103
41014104static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode *node) {
......@@ -4754,7 +4757,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo
47544757 if (lval == LValPtr)
47554758 return ptr_instruction;
47564759
4757 return ir_build_load_ptr(irb, scope, node, ptr_instruction);
4760 IrInstruction *load_ptr = ir_build_load_ptr(irb, scope, node, ptr_instruction);
4761 return ir_expr_wrap(irb, scope, load_ptr, result_loc);
47584762 }
47594763 case BuiltinFnIdTypeInfo:
47604764 {
......@@ -7772,7 +7776,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
77727776 case NodeTypeForExpr:
77737777 return ir_lval_wrap(irb, scope, ir_gen_for_expr(irb, scope, node), lval, result_loc);
77747778 case NodeTypeArrayAccessExpr:
7775 return ir_gen_array_access(irb, scope, node, lval);
7779 return ir_gen_array_access(irb, scope, node, lval, result_loc);
77767780 case NodeTypeReturnExpr:
77777781 return ir_gen_return(irb, scope, node, lval);
77787782 case NodeTypeFieldAccessExpr:
......@@ -7783,7 +7787,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
77837787 if (lval == LValPtr)
77847788 return ptr_instruction;
77857789
7786 return ir_build_load_ptr(irb, scope, node, ptr_instruction);
7790 IrInstruction *load_ptr = ir_build_load_ptr(irb, scope, node, ptr_instruction);
7791 return ir_expr_wrap(irb, scope, load_ptr, result_loc);
77877792 }
77887793 case NodeTypePtrDeref: {
77897794 AstNode *expr_node = node->data.ptr_deref_expr.target;
......@@ -7807,7 +7812,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
78077812 if (lval == LValPtr)
78087813 return unwrapped_ptr;
78097814
7810 return ir_build_load_ptr(irb, scope, node, unwrapped_ptr);
7815 IrInstruction *load_ptr = ir_build_load_ptr(irb, scope, node, unwrapped_ptr);
7816 return ir_expr_wrap(irb, scope, load_ptr, result_loc);
78117817 }
78127818 case NodeTypeBoolLiteral:
78137819 return ir_lval_wrap(irb, scope, ir_gen_bool_literal(irb, scope, node), lval, result_loc);
......@@ -13876,6 +13882,8 @@ static IrInstruction *ir_analyze_instruction_decl_var(IrAnalyze *ira,
1387613882 bool var_class_requires_const = false;
1387713883
1387813884 IrInstruction *var_ptr = decl_var_instruction->ptr->child;
13885 // if this assertion trips there may be a missing ir_expr_wrap in pass1 IR generation.
13886 ir_assert(var_ptr != nullptr, &decl_var_instruction->base);
1387913887 if (type_is_invalid(var_ptr->value.type)) {
1388013888 var->var_type = ira->codegen->builtin_types.entry_invalid;
1388113889 return ira->codegen->invalid_instruction;