| ... | ... | @@ -614,6 +614,8 @@ fn analyzeBodyInner( |
| 614 | 614 | crash_info.push(); |
| 615 | 615 | defer crash_info.pop(); |
| 616 | 616 | |
| 617 | var dbg_block_begins: u32 = 0; |
| 618 | |
| 617 | 619 | // We use a while(true) loop here to avoid a redundant way of breaking out of |
| 618 | 620 | // the loop. The only way to break out of the loop is with a `noreturn` |
| 619 | 621 | // instruction. |
| ... | ... | @@ -884,11 +886,13 @@ fn analyzeBodyInner( |
| 884 | 886 | .prefetch => try sema.zirPrefetch( block, extended), |
| 885 | 887 | // zig fmt: on |
| 886 | 888 | .dbg_block_begin => { |
| 889 | dbg_block_begins += 1; |
| 887 | 890 | try sema.zirDbgBlockBegin(block); |
| 888 | 891 | i += 1; |
| 889 | 892 | continue; |
| 890 | 893 | }, |
| 891 | 894 | .dbg_block_end => { |
| 895 | dbg_block_begins -= 1; |
| 892 | 896 | try sema.zirDbgBlockEnd(block); |
| 893 | 897 | i += 1; |
| 894 | 898 | continue; |
| ... | ... | @@ -1221,6 +1225,19 @@ fn analyzeBodyInner( |
| 1221 | 1225 | i += 1; |
| 1222 | 1226 | } else unreachable; |
| 1223 | 1227 | |
| 1228 | // balance out dbg_block_begins in case of early noreturn |
| 1229 | const noreturn_inst = block.instructions.popOrNull(); |
| 1230 | while (dbg_block_begins > 0) { |
| 1231 | dbg_block_begins -= 1; |
| 1232 | if (block.is_comptime or sema.mod.comp.bin_file.options.strip) continue; |
| 1233 | |
| 1234 | _ = try block.addInst(.{ |
| 1235 | .tag = .dbg_block_end, |
| 1236 | .data = undefined, |
| 1237 | }); |
| 1238 | } |
| 1239 | if (noreturn_inst) |some| try block.instructions.append(sema.gpa, some); |
| 1240 | |
| 1224 | 1241 | if (!wip_captures.finalized) { |
| 1225 | 1242 | try wip_captures.finalize(); |
| 1226 | 1243 | block.wip_capture_scope = parent_capture_scope; |