mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix #622 on both backends
This commit is contained in:
+3
-4
@@ -3307,10 +3307,9 @@ void ir_emit_defer_stmts(irProcedure *proc, irDeferExitKind kind, irBlock *block
|
|||||||
while (i --> 0) {
|
while (i --> 0) {
|
||||||
irDefer d = proc->defer_stmts[i];
|
irDefer d = proc->defer_stmts[i];
|
||||||
|
|
||||||
// TODO(bill, 2020-03-05): Why was this added?
|
isize prev_context_stack_count = proc->context_stack.count;
|
||||||
// if (proc->context_stack.count >= d.context_stack_count) {
|
defer (proc->context_stack.count = prev_context_stack_count);
|
||||||
// proc->context_stack.count = d.context_stack_count;
|
proc->context_stack.count = d.context_stack_count;
|
||||||
// }
|
|
||||||
|
|
||||||
if (kind == irDeferExit_Default) {
|
if (kind == irDeferExit_Default) {
|
||||||
if (proc->scope_index == d.scope_index &&
|
if (proc->scope_index == d.scope_index &&
|
||||||
|
|||||||
@@ -6432,6 +6432,11 @@ void lb_build_defer_stmt(lbProcedure *p, lbDefer d) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isize prev_context_stack_count = p->context_stack.count;
|
||||||
|
defer (p->context_stack.count = prev_context_stack_count);
|
||||||
|
p->context_stack.count = d.context_stack_count;
|
||||||
|
|
||||||
|
|
||||||
lbBlock *b = lb_create_block(p, "defer");
|
lbBlock *b = lb_create_block(p, "defer");
|
||||||
if (last_instr == nullptr || !LLVMIsATerminatorInst(last_instr)) {
|
if (last_instr == nullptr || !LLVMIsATerminatorInst(last_instr)) {
|
||||||
lb_emit_jump(p, b);
|
lb_emit_jump(p, b);
|
||||||
|
|||||||
Reference in New Issue
Block a user