aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig5
-rw-r--r--src/codegen/llvm.zig4
-rw-r--r--src/codegen/spirv.zig9
3 files changed, 7 insertions, 11 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index d4747256bb..92dc904c1a 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -13,7 +13,7 @@ const TypedValue = @import("../TypedValue.zig");
const C = link.File.C;
const Decl = Module.Decl;
const trace = @import("../tracy.zig").trace;
-const LazySrcLoc = Module.LazySrcLoc;
+const LazySrcLoc = std.zig.LazySrcLoc;
const Air = @import("../Air.zig");
const Liveness = @import("../Liveness.zig");
const InternPool = @import("../InternPool.zig");
@@ -570,8 +570,7 @@ pub const DeclGen = struct {
const mod = dg.module;
const decl_index = dg.pass.decl;
const decl = mod.declPtr(decl_index);
- const src = LazySrcLoc.nodeOffset(0);
- const src_loc = src.toSrcLoc(decl, mod);
+ const src_loc = decl.srcLoc(mod);
dg.error_msg = try Module.ErrorMsg.create(dg.gpa, src_loc, format, args);
return error.AnalysisFail;
}
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 331af769ca..827fee9f0a 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -23,7 +23,7 @@ const Air = @import("../Air.zig");
const Liveness = @import("../Liveness.zig");
const Value = @import("../Value.zig");
const Type = @import("../type.zig").Type;
-const LazySrcLoc = Module.LazySrcLoc;
+const LazySrcLoc = std.zig.LazySrcLoc;
const x86_64_abi = @import("../arch/x86_64/abi.zig");
const wasm_c_abi = @import("../arch/wasm/abi.zig");
const aarch64_c_abi = @import("../arch/aarch64/abi.zig");
@@ -4686,7 +4686,7 @@ pub const DeclGen = struct {
const o = dg.object;
const gpa = o.gpa;
const mod = o.module;
- const src_loc = LazySrcLoc.nodeOffset(0).toSrcLoc(dg.decl, mod);
+ const src_loc = dg.decl.srcLoc(mod);
dg.err_msg = try Module.ErrorMsg.create(gpa, src_loc, "TODO (LLVM): " ++ format, args);
return error.CodegenFail;
}
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index ca724c3879..fb8d1e1e8e 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -8,9 +8,8 @@ const Module = @import("../Module.zig");
const Decl = Module.Decl;
const Type = @import("../type.zig").Type;
const Value = @import("../Value.zig");
-const LazySrcLoc = Module.LazySrcLoc;
+const LazySrcLoc = std.zig.LazySrcLoc;
const Air = @import("../Air.zig");
-const Zir = @import("../Zir.zig");
const Liveness = @import("../Liveness.zig");
const InternPool = @import("../InternPool.zig");
@@ -413,8 +412,7 @@ const DeclGen = struct {
pub fn fail(self: *DeclGen, comptime format: []const u8, args: anytype) Error {
@setCold(true);
const mod = self.module;
- const src = LazySrcLoc.nodeOffset(0);
- const src_loc = src.toSrcLoc(self.module.declPtr(self.decl_index), mod);
+ const src_loc = self.module.declPtr(self.decl_index).srcLoc(mod);
assert(self.error_msg == null);
self.error_msg = try Module.ErrorMsg.create(self.module.gpa, src_loc, format, args);
return error.CodegenFail;
@@ -5270,8 +5268,7 @@ const DeclGen = struct {
// TODO: Translate proper error locations.
assert(as.errors.items.len != 0);
assert(self.error_msg == null);
- const loc = LazySrcLoc.nodeOffset(0);
- const src_loc = loc.toSrcLoc(self.module.declPtr(self.decl_index), mod);
+ const src_loc = self.module.declPtr(self.decl_index).srcLoc(mod);
self.error_msg = try Module.ErrorMsg.create(self.module.gpa, src_loc, "failed to assemble SPIR-V inline assembly", .{});
const notes = try self.module.gpa.alloc(Module.ErrorMsg, as.errors.items.len);