| ... | @@ -2967,12 +2967,11 @@ static IrInstGen *ir_build_test_non_null_gen(IrAnalyze *ira, IrInst *source_inst | ... | @@ -2967,12 +2967,11 @@ static IrInstGen *ir_build_test_non_null_gen(IrAnalyze *ira, IrInst *source_inst |
| 2967 | } | 2967 | } |
| 2968 | | 2968 | |
| 2969 | static IrInstSrc *ir_build_optional_unwrap_ptr(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, | 2969 | static 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) |
| 2971 | { | 2971 | { |
| 2972 | IrInstSrcOptionalUnwrapPtr *instruction = ir_build_instruction<IrInstSrcOptionalUnwrapPtr>(irb, scope, source_node); | 2972 | IrInstSrcOptionalUnwrapPtr *instruction = ir_build_instruction<IrInstSrcOptionalUnwrapPtr>(irb, scope, source_node); |
| 2973 | instruction->base_ptr = base_ptr; | 2973 | instruction->base_ptr = base_ptr; |
| 2974 | instruction->safety_check_on = safety_check_on; | 2974 | instruction->safety_check_on = safety_check_on; |
| 2975 | instruction->initializing = initializing; | | |
| 2976 | | 2975 | |
| 2977 | ir_ref_instruction(base_ptr, irb->current_basic_block); | 2976 | ir_ref_instruction(base_ptr, irb->current_basic_block); |
| 2978 | | 2977 | |
| ... | @@ -5721,7 +5720,7 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode | ... | @@ -5721,7 +5720,7 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode |
| 5721 | ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime)); | 5720 | ir_mark_gen(ir_build_br(irb, parent_scope, node, end_block, is_comptime)); |
| 5722 | | 5721 | |
| 5723 | ir_set_cursor_at_end_and_append_block(irb, ok_block); | 5722 | 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); |
| 5725 | IrInstSrc *unwrapped_payload = ir_build_load_ptr(irb, parent_scope, node, unwrapped_ptr); | 5724 | IrInstSrc *unwrapped_payload = ir_build_load_ptr(irb, parent_scope, node, unwrapped_ptr); |
| 5726 | ir_build_end_expr(irb, parent_scope, node, unwrapped_payload, &peer_parent->peers.at(1)->base); | 5725 | ir_build_end_expr(irb, parent_scope, node, unwrapped_payload, &peer_parent->peers.at(1)->base); |
| 5727 | IrBasicBlockSrc *after_ok_block = irb->current_basic_block; | 5726 | IrBasicBlockSrc *after_ok_block = irb->current_basic_block; |
| ... | @@ -8080,7 +8079,7 @@ static IrInstSrc *ir_gen_while_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no | ... | @@ -8080,7 +8079,7 @@ static IrInstSrc *ir_gen_while_expr(IrBuilderSrc *irb, Scope *scope, AstNode *no |
| 8080 | is_comptime); | 8079 | is_comptime); |
| 8081 | | 8080 | |
| 8082 | ir_set_cursor_at_end_and_append_block(irb, body_block); | 8081 | 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); |
| 8084 | IrInstSrc *var_value = node->data.while_expr.var_is_ptr ? | 8083 | IrInstSrc *var_value = node->data.while_expr.var_is_ptr ? |
| 8085 | payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, symbol_node, payload_ptr); | 8084 | payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, symbol_node, payload_ptr); |
| 8086 | build_decl_var_and_init(irb, child_scope, symbol_node, payload_var, var_value, buf_ptr(var_symbol), is_comptime); | 8085 | 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 | ... | @@ -8743,7 +8742,7 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo |
| 8743 | ZigVar *var = ir_create_var(irb, node, subexpr_scope, | 8742 | ZigVar *var = ir_create_var(irb, node, subexpr_scope, |
| 8744 | var_symbol, is_const, is_const, is_shadowable, is_comptime); | 8743 | var_symbol, is_const, is_const, is_shadowable, is_comptime); |
| 8745 | | 8744 | |
| 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); |
| 8747 | IrInstSrc *var_value = var_is_ptr ? | 8746 | IrInstSrc *var_value = var_is_ptr ? |
| 8748 | payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, node, payload_ptr); | 8747 | payload_ptr : ir_build_load_ptr(irb, &spill_scope->base, node, payload_ptr); |
| 8749 | build_decl_var_and_init(irb, subexpr_scope, node, var, var_value, buf_ptr(var_symbol), is_comptime); | 8748 | 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 | ... | @@ -9987,7 +9986,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope |
| 9987 | if (maybe_ptr == irb->codegen->invalid_inst_src) | 9986 | if (maybe_ptr == irb->codegen->invalid_inst_src) |
| 9988 | return irb->codegen->invalid_inst_src; | 9987 | return irb->codegen->invalid_inst_src; |
| 9989 | | 9988 | |
| 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 ); |
| 9991 | if (lval == LValPtr || lval == LValAssign) | 9990 | if (lval == LValPtr || lval == LValAssign) |
| 9992 | return unwrapped_ptr; | 9991 | return unwrapped_ptr; |
| 9993 | | 9992 | |