aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-08-20 16:05:04 +0100
committermlugg <mlugg@mlugg.co.uk>2024-08-21 01:30:46 +0100
commita99ad52b362d966f772f29ad14ae1714218bc033 (patch)
treead8a93f55ed7c4cff101789aedea0b5cc930d0f6 /src
parent2fb78430dbff206af24ecd5e7be163e624fdbb6f (diff)
downloadzig-a99ad52b362d966f772f29ad14ae1714218bc033.tar.gz
zig-a99ad52b362d966f772f29ad14ae1714218bc033.zip
Sema: register correct dependencies for inline calls
And add a corresponding test case.
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index b0f2623652..3752cefe3f 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -7598,6 +7598,9 @@ fn analyzeCall(
const module_fn = zcu.funcInfo(module_fn_index);
+ // The call site definitely depends on the function's signature.
+ try sema.declareDependency(.{ .src_hash = module_fn.zir_body_inst });
+
// This is not a function instance, so the function's `Nav` has a
// `Cau` -- we don't need to check `generic_owner`.
const fn_nav = ip.getNav(module_fn.owner_nav);
@@ -7755,6 +7758,10 @@ fn analyzeCall(
break :res Air.internedToRef(memoized_call.result);
}
+ // Since we're doing an inline call, we depend on the source code of the whole
+ // function declaration.
+ try sema.declareDependency(.{ .src_hash = fn_cau.zir_index });
+
new_fn_info.return_type = sema.fn_ret_ty.toIntern();
if (!is_comptime_call and !block.is_typeof) {
const zir_tags = sema.code.instructions.items(.tag);