diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-02-28 02:05:10 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-02-29 23:38:18 +0000 |
| commit | 321045cf33268e7b75e2972d898010ecacc345dc (patch) | |
| tree | 0d296a3879ad1e6feb059947150dbbac933b547f /src/Sema.zig | |
| parent | f51d9ab892caeb63c40fcd2c1da4ade70038119c (diff) | |
| download | zig-321045cf33268e7b75e2972d898010ecacc345dc.tar.gz zig-321045cf33268e7b75e2972d898010ecacc345dc.zip | |
codegen: handle dbg_var scoping correctly after eliding more ZIR blocks
Since we now elide more ZIR blocks in AstGen, care must be taken in
codegen to introduce lexical scopes for every body, not just `block`s.
Also, elide a few unnecessary AIR blocks in Sema.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 7bc96c8e21..426c32c2b6 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -11508,6 +11508,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp sub_block.runtime_loop = null; sub_block.runtime_cond = mod.declPtr(child_block.src_decl).toSrcLoc(main_operand_src, mod); sub_block.runtime_index.increment(); + sub_block.need_debug_scope = null; // this body is emitted regardless defer sub_block.instructions.deinit(gpa); try sema.analyzeBodyRuntimeBreak(&sub_block, non_error_case.body); @@ -12243,6 +12244,7 @@ fn analyzeSwitchRuntimeBlock( case_block.runtime_loop = null; case_block.runtime_cond = mod.declPtr(child_block.src_decl).toSrcLoc(operand_src, mod); case_block.runtime_index.increment(); + case_block.need_debug_scope = null; // this body is emitted regardless defer case_block.instructions.deinit(gpa); var extra_index: usize = special.end; @@ -18967,8 +18969,7 @@ fn zirCondbr( const body = if (cond_val.toBool()) then_body else else_body; try sema.maybeErrorUnwrapCondbr(parent_block, body, extra.data.condition, cond_src); - // We use `analyzeBodyInner` since we want to propagate any possible - // `error.ComptimeBreak` to the caller. + // We use `analyzeBodyInner` since we want to propagate any comptime control flow to the caller. return sema.analyzeBodyInner(parent_block, body); } @@ -18980,6 +18981,7 @@ fn zirCondbr( sub_block.runtime_loop = null; sub_block.runtime_cond = mod.declPtr(parent_block.src_decl).toSrcLoc(cond_src, mod); sub_block.runtime_index.increment(); + sub_block.need_debug_scope = null; // this body is emitted regardless defer sub_block.instructions.deinit(gpa); try sema.analyzeBodyRuntimeBreak(&sub_block, then_body); |
