| ... | @@ -26619,6 +26619,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -26619,6 +26619,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 26619 | | 26619 | |
| 26620 | const pt = sema.pt; | 26620 | const pt = sema.pt; |
| 26621 | const zcu = pt.zcu; | 26621 | const zcu = pt.zcu; |
| | 26622 | const ip = &zcu.intern_pool; |
| 26622 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; | 26623 | const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].pl_node; |
| 26623 | const extra = sema.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); | 26624 | const extra = sema.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); |
| 26624 | const target = zcu.getTarget(); | 26625 | const target = zcu.getTarget(); |
| ... | @@ -26789,7 +26790,21 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -26789,7 +26790,21 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 26789 | | 26790 | |
| 26790 | const zir_decl = sema.code.getDeclaration(decl_inst.resolve(&zcu.intern_pool) orelse return error.AnalysisFail)[0]; | 26791 | const zir_decl = sema.code.getDeclaration(decl_inst.resolve(&zcu.intern_pool) orelse return error.AnalysisFail)[0]; |
| 26791 | if (zir_decl.flags.is_export) { | 26792 | if (zir_decl.flags.is_export) { |
| 26792 | break :cc .C; | 26793 | break :cc target.cCallingConvention() orelse { |
| | 26794 | // This target has no default C calling convention. We sometimes trigger a similar |
| | 26795 | // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, |
| | 26796 | // let's eval that now and just get the transitive error. (It's guaranteed to error |
| | 26797 | // because it does the exact `cCallingConvention` call we just did.) |
| | 26798 | const cc_type = try sema.getBuiltinType("CallingConvention"); |
| | 26799 | _ = try sema.namespaceLookupVal( |
| | 26800 | block, |
| | 26801 | LazySrcLoc.unneeded, |
| | 26802 | cc_type.getNamespaceIndex(zcu), |
| | 26803 | try ip.getOrPutString(sema.gpa, pt.tid, "c", .no_embedded_nulls), |
| | 26804 | ); |
| | 26805 | // The above should have errored. |
| | 26806 | @panic("std.builtin is corrupt"); |
| | 26807 | }; |
| 26793 | } | 26808 | } |
| 26794 | } | 26809 | } |
| 26795 | break :cc .auto; | 26810 | break :cc .auto; |