authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2020-05-01 20:57:56-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-05-01 20:57:56-04:00
log3dbe02e2d8cda1fe0072e71ae7630170c270419e
tree17c9c46c8774fc8e5972efca9a3e58089edec32c
parent3386bb896d071eef4ff571fac399e18b2270a382
parent09d6dc1ce6cf90712eee72ec6cdf9e9ec2ceb370
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #5247 from mikdusan/housekeeping

stage1: cleanup

2 files changed, 5 insertions(+), 7 deletions(-)

src/all_types.hpp-1
......@@ -3453,7 +3453,6 @@ struct IrInstSrcOptionalUnwrapPtr {
34533453
34543454 IrInstSrc *base_ptr;
34553455 bool safety_check_on;
3456 bool initializing;
34573456};
34583457
34593458struct IrInstGenOptionalUnwrapPtr {
src/ir.cpp+5-6
......@@ -2967,12 +2967,11 @@ static IrInstGen *ir_build_test_non_null_gen(IrAnalyze *ira, IrInst *source_inst
29672967}
29682968
29692969static IrInstSrc *ir_build_optional_unwrap_ptr(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
2970 IrInstSrc *base_ptr, bool safety_check_on, bool initializing)
2970 IrInstSrc *base_ptr, bool safety_check_on)
29712971{
29722972 IrInstSrcOptionalUnwrapPtr *instruction = ir_build_instruction<IrInstSrcOptionalUnwrapPtr>(irb, scope, source_node);
29732973 instruction->base_ptr = base_ptr;
29742974 instruction->safety_check_on = safety_check_on;
2975 instruction->initializing = initializing;
29762975
29772976 ir_ref_instruction(base_ptr, irb->current_basic_block);
29782977
......@@ -5721,7 +5720,7 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode
57215720 ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime));
57225721
57235722 ir_set_cursor_at_end_and_append_block(irb, ok_block);
5724 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, parent_scope, node, maybe_ptr, false, false);
5723 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, parent_scope, node, maybe_ptr, false);
57255724 IrInstSrc *unwrapped_payload = ir_build_load_ptr(irb, parent_scope, node, unwrapped_ptr);
57265725 ir_build_end_expr(irb, parent_scope, node, unwrapped_payload, &peer_parent->peers.at(1)->base);
57275726 IrBasicBlockSrc *after_ok_block = irb->current_basic_block;
......@@ -8080,7 +8079,7 @@ static IrInstSrc *ir_gen_while_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no
80808079 is_comptime);
80818080
80828081 ir_set_cursor_at_end_and_append_block(irb, body_block);
8083 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, &spill_scope->base, symbol_node, maybe_val_ptr, false, false);
8082 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, &spill_scope->base, symbol_node, maybe_val_ptr, false);
80848083 IrInstSrc *var_value = node->data.while_expr.var_is_ptr ?
80858084 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, symbol_node, payload_ptr);
80868085 build_decl_var_and_init(irb, child_scope, symbol_node, payload_var, var_value, buf_ptr(var_symbol), is_comptime);
......@@ -8743,7 +8742,7 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo
87438742 ZigVar *var = ir_create_var(irb, node, subexpr_scope,
87448743 var_symbol, is_const, is_const, is_shadowable, is_comptime);
87458744
8746 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, subexpr_scope, node, maybe_val_ptr, false, false);
8745 IrInstSrc *payload_ptr = ir_build_optional_unwrap_ptr(irb, subexpr_scope, node, maybe_val_ptr, false);
87478746 IrInstSrc *var_value = var_is_ptr ?
87488747 payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, node, payload_ptr);
87498748 build_decl_var_and_init(irb, subexpr_scope, node, var, var_value, buf_ptr(var_symbol), is_comptime);
......@@ -9987,7 +9986,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope
99879986 if (maybe_ptr == irb->codegen->invalid_inst_src)
99889987 return irb->codegen->invalid_inst_src;
99899988
9990 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, scope, node, maybe_ptr, true, false);
9989 IrInstSrc *unwrapped_ptr = ir_build_optional_unwrap_ptr(irb, scope, node, maybe_ptr, true );
99919990 if (lval == LValPtr || lval == LValAssign)
99929991 return unwrapped_ptr;
99939992