aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-18 12:37:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-18 19:02:06 -0700
commitabe71b40c54c98badd4b18328ae22c8425add4b3 (patch)
treef28b1a155583bf065a6074c18d65c99cd8ca3798 /src
parent3f2a4720b1ef057215c8240b3a377c523ee63e94 (diff)
downloadzig-abe71b40c54c98badd4b18328ae22c8425add4b3.tar.gz
zig-abe71b40c54c98badd4b18328ae22c8425add4b3.zip
Sema: use src_decl for exported status
Fixes wrong calling convention in instantiated functions.
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 5cee5718f8..6af7c59e57 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -8459,9 +8459,7 @@ fn zirFunc(
inst: Zir.Inst.Index,
inferred_error_set: bool,
) CompileError!Air.Inst.Ref {
- const tracy = trace(@src());
- defer tracy.end();
-
+ const mod = sema.mod;
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
const extra = sema.code.extraData(Zir.Inst.Func, inst_data.payload_index);
const target = sema.mod.getTarget();
@@ -8502,8 +8500,7 @@ fn zirFunc(
// If this instruction has a body it means it's the type of the `owner_decl`
// otherwise it's a function type without a `callconv` attribute and should
// never be `.C`.
- // NOTE: revisit when doing #1717
- const cc: std.builtin.CallingConvention = if (sema.owner_decl.is_exported and has_body)
+ const cc: std.builtin.CallingConvention = if (has_body and mod.declPtr(block.src_decl).is_exported)
.C
else
.Unspecified;