diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-08 16:52:59 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:42:30 -0700 |
| commit | 275652f620541919087bc92da0d2f9e97c66d3c0 (patch) | |
| tree | 0b19398252ef29e6b0a6c6758ac90f564a235f13 /src/codegen/c.zig | |
| parent | e94a81c951905a6b5bcf2a6028589ac1e33d1edd (diff) | |
| download | zig-275652f620541919087bc92da0d2f9e97c66d3c0.tar.gz zig-275652f620541919087bc92da0d2f9e97c66d3c0.zip | |
stage2: move opaque types to InternPool
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 60f2d86a3d..36af222c7e 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -524,8 +524,9 @@ pub const DeclGen = struct { fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } { @setCold(true); + const mod = dg.module; const src = LazySrcLoc.nodeOffset(0); - const src_loc = src.toSrcLoc(dg.decl.?); + const src_loc = src.toSrcLoc(dg.decl.?, mod); dg.error_msg = try Module.ErrorMsg.create(dg.gpa, src_loc, format, args); return error.AnalysisFail; } @@ -6484,6 +6485,7 @@ fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { } fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { + const mod = f.object.dg.module; const un_op = f.air.instructions.items(.data)[inst].un_op; const inst_ty = f.typeOfIndex(inst); @@ -6495,7 +6497,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { const local = try f.allocLocal(inst, inst_ty); try f.writeCValue(writer, local, .Other); try writer.print(" = {s}(", .{ - try f.getLazyFnName(.{ .tag_name = enum_ty.getOwnerDecl() }, .{ .tag_name = enum_ty }), + try f.getLazyFnName(.{ .tag_name = enum_ty.getOwnerDecl(mod) }, .{ .tag_name = enum_ty }), }); try f.writeCValue(writer, operand, .Other); try writer.writeAll(");\n"); |
