aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-06-07 17:48:53 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-06-09 15:37:16 -0700
commitbac132bc8fb320620ca5ad554ce515ccb7e4dad1 (patch)
treef939fe43fd6d8d1fced831c6a4e96478eef0edec /src/codegen
parentf1cff4fa4a28d42ac9055f94ee9a8f7fd2831cd7 (diff)
downloadzig-bac132bc8fb320620ca5ad554ce515ccb7e4dad1.tar.gz
zig-bac132bc8fb320620ca5ad554ce515ccb7e4dad1.zip
introduce std.debug.Trace
And use it to debug a LazySrcLoc in stage2 that is set to a bogus value. The actual fix in this commit is: ```diff - try sema.emitBackwardBranch(&child_block, call_src); + try sema.emitBackwardBranch(block, call_src); ```
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig2
-rw-r--r--src/codegen/llvm.zig2
-rw-r--r--src/codegen/spirv.zig4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 4c2239b306..45191f3107 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -363,7 +363,7 @@ pub const DeclGen = struct {
fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } {
@setCold(true);
- const src: LazySrcLoc = .{ .node_offset = 0 };
+ const src = LazySrcLoc.nodeOffset(0);
const src_loc = src.toSrcLoc(dg.decl);
dg.error_msg = try Module.ErrorMsg.create(dg.module.gpa, src_loc, format, args);
return error.AnalysisFail;
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 188c2f6f11..60803eff69 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -2163,7 +2163,7 @@ pub const DeclGen = struct {
fn todo(self: *DeclGen, comptime format: []const u8, args: anytype) Error {
@setCold(true);
assert(self.err_msg == null);
- const src_loc = @as(LazySrcLoc, .{ .node_offset = 0 }).toSrcLoc(self.decl);
+ const src_loc = LazySrcLoc.nodeOffset(0).toSrcLoc(self.decl);
self.err_msg = try Module.ErrorMsg.create(self.gpa, src_loc, "TODO (LLVM): " ++ format, args);
return error.CodegenFail;
}
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 0dc39db134..9879bc7f35 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -184,7 +184,7 @@ pub const DeclGen = struct {
fn fail(self: *DeclGen, comptime format: []const u8, args: anytype) Error {
@setCold(true);
- const src: LazySrcLoc = .{ .node_offset = 0 };
+ const src = LazySrcLoc.nodeOffset(0);
const src_loc = src.toSrcLoc(self.decl);
assert(self.error_msg == null);
self.error_msg = try Module.ErrorMsg.create(self.module.gpa, src_loc, format, args);
@@ -193,7 +193,7 @@ pub const DeclGen = struct {
fn todo(self: *DeclGen, comptime format: []const u8, args: anytype) Error {
@setCold(true);
- const src: LazySrcLoc = .{ .node_offset = 0 };
+ const src = LazySrcLoc.nodeOffset(0);
const src_loc = src.toSrcLoc(self.decl);
assert(self.error_msg == null);
self.error_msg = try Module.ErrorMsg.create(self.module.gpa, src_loc, "TODO (SPIR-V): " ++ format, args);