diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-10-21 20:24:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-21 20:24:37 -0700 |
| commit | 09236d29b7722d71533478aa7080706acde28d0d (patch) | |
| tree | d1c5776cf14fc9f579e7fb5ce99de9a015e80eac /src/Module.zig | |
| parent | b9103bd514e46a43ab0f3dce397af2ea8a789fda (diff) | |
| parent | c36a2c27a51039d486f4149018154687a300d1eb (diff) | |
| download | zig-09236d29b7722d71533478aa7080706acde28d0d.tar.gz zig-09236d29b7722d71533478aa7080706acde28d0d.zip | |
Merge pull request #12837 from topolarity/err-ret-trace-improvements-1923
stage2: Pop error trace frames for handled errors (#1923)
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 8483c41ae8..4f150b0148 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -5633,6 +5633,12 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air { const last_arg_index = inner_block.instructions.items.len; + // Save the error trace as our first action in the function. + // If this is unnecessary after all, Liveness will clean it up for us. + const error_return_trace_index = try sema.analyzeSaveErrRetIndex(&inner_block); + sema.error_return_trace_index_on_fn_entry = error_return_trace_index; + inner_block.error_return_trace_index = error_return_trace_index; + sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) { // TODO make these unreachable instead of @panic error.NeededSourceLocation => @panic("zig compiler bug: NeededSourceLocation"), |
