| ... | @@ -2724,6 +2724,12 @@ static LLVMValueRef gen_switch_expr(CodeGen *g, AstNode *node) { | ... | @@ -2724,6 +2724,12 @@ static LLVMValueRef gen_switch_expr(CodeGen *g, AstNode *node) { |
| 2724 | static LLVMValueRef gen_goto(CodeGen *g, AstNode *node) { | 2724 | static LLVMValueRef gen_goto(CodeGen *g, AstNode *node) { |
| 2725 | assert(node->type == NodeTypeGoto); | 2725 | assert(node->type == NodeTypeGoto); |
| 2726 | | 2726 | |
| | 2727 | // generate defers for blocks that we exit |
| | 2728 | LabelTableEntry *label = node->data.goto_expr.label_entry; |
| | 2729 | BlockContext *this_context = node->block_context; |
| | 2730 | BlockContext *target_context = label->decl_node->block_context; |
| | 2731 | gen_defers_for_block(g, this_context, target_context, false, false); |
| | 2732 | |
| 2727 | add_debug_source_node(g, node); | 2733 | add_debug_source_node(g, node); |
| 2728 | LLVMBuildBr(g->builder, node->data.goto_expr.label_entry->basic_block); | 2734 | LLVMBuildBr(g->builder, node->data.goto_expr.label_entry->basic_block); |
| 2729 | return nullptr; | 2735 | return nullptr; |