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...@@ -22,5 +22,3 @@ inferred comptime
22 return ir_build_ref(irb, scope, value->source_node, value, false, false);22 return ir_build_ref(irb, scope, value->source_node, value, false, false);
2323
24handle if with no else24handle 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,...@@ -4049,7 +4049,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
4049 if (lval == LValPtr) {4049 if (lval == LValPtr) {
4050 return ir_build_ref(irb, scope, node, value, false, false);4050 return ir_build_ref(irb, scope, node, value, false, false);
4051 } else {4051 } else {
4052 return value;4052 return ir_expr_wrap(irb, scope, value, result_loc);
4053 }4053 }
4054 }4054 }
40554055
...@@ -4077,7 +4077,9 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,...@@ -4077,7 +4077,9 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node,
4077 return ir_build_undeclared_identifier(irb, scope, node, variable_name);4077 return ir_build_undeclared_identifier(irb, scope, node, variable_name);
4078}4078}
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{
4081 assert(node->type == NodeTypeArrayAccessExpr);4083 assert(node->type == NodeTypeArrayAccessExpr);
40824084
4083 AstNode *array_ref_node = node->data.array_access_expr.array_ref_expr;4085 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...@@ -4095,7 +4097,8 @@ static IrInstruction *ir_gen_array_access(IrBuilder *irb, Scope *scope, AstNode
4095 if (lval == LValPtr)4097 if (lval == LValPtr)
4096 return ptr_instruction;4098 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);
4099}4102}
41004103
4101static IrInstruction *ir_gen_field_access(IrBuilder *irb, Scope *scope, AstNode *node) {4104static 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...@@ -4754,7 +4757,8 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo
4754 if (lval == LValPtr)4757 if (lval == LValPtr)
4755 return ptr_instruction;4758 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);
4758 }4762 }
4759 case BuiltinFnIdTypeInfo:4763 case BuiltinFnIdTypeInfo:
4760 {4764 {
...@@ -7772,7 +7776,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop...@@ -7772,7 +7776,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
7772 case NodeTypeForExpr:7776 case NodeTypeForExpr:
7773 return ir_lval_wrap(irb, scope, ir_gen_for_expr(irb, scope, node), lval, result_loc);7777 return ir_lval_wrap(irb, scope, ir_gen_for_expr(irb, scope, node), lval, result_loc);
7774 case NodeTypeArrayAccessExpr:7778 case NodeTypeArrayAccessExpr:
7775 return ir_gen_array_access(irb, scope, node, lval);7779 return ir_gen_array_access(irb, scope, node, lval, result_loc);
7776 case NodeTypeReturnExpr:7780 case NodeTypeReturnExpr:
7777 return ir_gen_return(irb, scope, node, lval);7781 return ir_gen_return(irb, scope, node, lval);
7778 case NodeTypeFieldAccessExpr:7782 case NodeTypeFieldAccessExpr:
...@@ -7783,7 +7787,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop...@@ -7783,7 +7787,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
7783 if (lval == LValPtr)7787 if (lval == LValPtr)
7784 return ptr_instruction;7788 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);
7787 }7792 }
7788 case NodeTypePtrDeref: {7793 case NodeTypePtrDeref: {
7789 AstNode *expr_node = node->data.ptr_deref_expr.target;7794 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...@@ -7807,7 +7812,8 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
7807 if (lval == LValPtr)7812 if (lval == LValPtr)
7808 return unwrapped_ptr;7813 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);
7811 }7817 }
7812 case NodeTypeBoolLiteral:7818 case NodeTypeBoolLiteral:
7813 return ir_lval_wrap(irb, scope, ir_gen_bool_literal(irb, scope, node), lval, result_loc);7819 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,...@@ -13876,6 +13882,8 @@ static IrInstruction *ir_analyze_instruction_decl_var(IrAnalyze *ira,
13876 bool var_class_requires_const = false;13882 bool var_class_requires_const = false;
1387713883
13878 IrInstruction *var_ptr = decl_var_instruction->ptr->child;13884 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);
13879 if (type_is_invalid(var_ptr->value.type)) {13887 if (type_is_invalid(var_ptr->value.type)) {
13880 var->var_type = ira->codegen->builtin_types.entry_invalid;13888 var->var_type = ira->codegen->builtin_types.entry_invalid;
13881 return ira->codegen->invalid_instruction;13889 return ira->codegen->invalid_instruction;