authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-10-09 17:14:31+03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-10-09 21:00:31-07:00
logb2c36b14de97a2333a9db761c54ae86bd483cb1d
tree766bd696c31e9efa3c782c4541264bbb13ad7cef
parent1f6d82ec01b09b7a8a6285810dd4c68624621df3

Sema: fix `dbg_inline` instructions not being emitted

This broke with #16604 but went unnoticed due to lack of tests. Closes #17444

1 files changed, 3 insertions(+), 2 deletions(-)

src/Sema.zig+3-2
...@@ -7281,6 +7281,7 @@ fn analyzeCall(...@@ -7281,6 +7281,7 @@ fn analyzeCall(
7281 .needed_comptime_reason = "function being called at comptime must be comptime-known",7281 .needed_comptime_reason = "function being called at comptime must be comptime-known",
7282 .block_comptime_reason = comptime_reason,7282 .block_comptime_reason = comptime_reason,
7283 });7283 });
7284 const prev_fn_index = sema.func_index;
7284 const module_fn_index = switch (mod.intern_pool.indexToKey(func_val.toIntern())) {7285 const module_fn_index = switch (mod.intern_pool.indexToKey(func_val.toIntern())) {
7285 .extern_func => return sema.fail(block, call_src, "{s} call of extern function", .{7286 .extern_func => return sema.fail(block, call_src, "{s} call of extern function", .{
7286 @as([]const u8, if (is_comptime_call) "comptime" else "inline"),7287 @as([]const u8, if (is_comptime_call) "comptime" else "inline"),
...@@ -7478,7 +7479,7 @@ fn analyzeCall(...@@ -7478,7 +7479,7 @@ fn analyzeCall(
7478 new_fn_info.return_type = sema.fn_ret_ty.toIntern();7479 new_fn_info.return_type = sema.fn_ret_ty.toIntern();
7479 const new_func_resolved_ty = try mod.funcType(new_fn_info);7480 const new_func_resolved_ty = try mod.funcType(new_fn_info);
7480 if (!is_comptime_call and !block.is_typeof) {7481 if (!is_comptime_call and !block.is_typeof) {
7481 try sema.emitDbgInline(block, sema.func_index, module_fn_index, new_func_resolved_ty, .dbg_inline_begin);7482 try sema.emitDbgInline(block, prev_fn_index, module_fn_index, new_func_resolved_ty, .dbg_inline_begin);
74827483
7483 const zir_tags = sema.code.instructions.items(.tag);7484 const zir_tags = sema.code.instructions.items(.tag);
7484 for (fn_info.param_body) |param| switch (zir_tags[param]) {7485 for (fn_info.param_body) |param| switch (zir_tags[param]) {
...@@ -7519,7 +7520,7 @@ fn analyzeCall(...@@ -7519,7 +7520,7 @@ fn analyzeCall(
7519 try sema.emitDbgInline(7520 try sema.emitDbgInline(
7520 block,7521 block,
7521 module_fn_index,7522 module_fn_index,
7522 sema.func_index,7523 prev_fn_index,
7523 mod.funcOwnerDeclPtr(sema.func_index).ty,7524 mod.funcOwnerDeclPtr(sema.func_index).ty,
7524 .dbg_inline_end,7525 .dbg_inline_end,
7525 );7526 );