| ... | @@ -9347,13 +9347,17 @@ fn zirFunc( | ... | @@ -9347,13 +9347,17 @@ fn zirFunc( |
| 9347 | src_locs = sema.code.extraData(Zir.Inst.Func.SrcLocs, extra_index).data; | 9347 | src_locs = sema.code.extraData(Zir.Inst.Func.SrcLocs, extra_index).data; |
| 9348 | } | 9348 | } |
| 9349 | | 9349 | |
| 9350 | // If this instruction has a body it means it's the type of the `owner_decl` | 9350 | // If this instruction has a body, then it's a function declaration, and we decide |
| 9351 | // otherwise it's a function type without a `callconv` attribute and should | 9351 | // the callconv based on whether it is exported. Otherwise, the callconv defaults |
| 9352 | // never be `.C`. | 9352 | // to `.Unspecified`. |
| 9353 | const cc: std.builtin.CallingConvention = if (has_body and mod.declPtr(sema.owner_decl_index).is_exported) | 9353 | const cc: std.builtin.CallingConvention = if (has_body) cc: { |
| 9354 | .C | 9354 | const fn_is_exported = if (sema.generic_owner != .none) exported: { |
| 9355 | else | 9355 | const generic_owner_fn = mod.funcInfo(sema.generic_owner); |
| 9356 | .Unspecified; | 9356 | const generic_owner_decl = mod.declPtr(generic_owner_fn.owner_decl); |
| | 9357 | break :exported generic_owner_decl.is_exported; |
| | 9358 | } else sema.owner_decl.is_exported; |
| | 9359 | break :cc if (fn_is_exported) .C else .Unspecified; |
| | 9360 | } else .Unspecified; |
| 9357 | | 9361 | |
| 9358 | return sema.funcCommon( | 9362 | return sema.funcCommon( |
| 9359 | block, | 9363 | block, |