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