diff options
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 89bfc4d294..e2c3b6667b 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2724,6 +2724,12 @@ static LLVMValueRef gen_switch_expr(CodeGen *g, AstNode *node) { static LLVMValueRef gen_goto(CodeGen *g, AstNode *node) { assert(node->type == NodeTypeGoto); + // generate defers for blocks that we exit + LabelTableEntry *label = node->data.goto_expr.label_entry; + BlockContext *this_context = node->block_context; + BlockContext *target_context = label->decl_node->block_context; + gen_defers_for_block(g, this_context, target_context, false, false); + add_debug_source_node(g, node); LLVMBuildBr(g->builder, node->data.goto_expr.label_entry->basic_block); return nullptr; |
