authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-18 13:46:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:12-07:00
log8df1b91d17dcc81a15458d5c73351bca3106922a
tree44cf191e20c1342992c2f5cca65f814ae201766d
parente5d21e10bc6e652a72cf22ad1b1cf8ba8692abbf

Autodoc: clean up debug printing

use std.log.scoped

1 files changed, 20 insertions(+), 21 deletions(-)

src/Autodoc.zig+20-21
......@@ -7,6 +7,7 @@ const File = Module.File;
77const Package = @import("Package.zig");
88const Zir = @import("Zir.zig");
99const Ref = Zir.Inst.Ref;
10const log = std.log.scoped(.autodoc);
1011
1112module: *Module,
1213doc_location: Compilation.EmitLoc,
......@@ -62,7 +63,7 @@ pub fn deinit(_: *Autodoc) void {
6263pub fn generateZirData(self: *Autodoc) !void {
6364 if (self.doc_location.directory) |dir| {
6465 if (dir.path) |path| {
65 std.debug.print("path: {s}\n", .{path});
66 log.debug("path: {s}", .{path});
6667 }
6768 }
6869
......@@ -1700,12 +1701,12 @@ fn walkInstruction(
17001701 // const ast_line = self.ast_nodes.items[ast_index - 1];
17011702
17021703 // const sep = "=" ** 200;
1703 // std.debug.print("{s}\n", .{sep});
1704 // std.debug.print("SWITCH BLOCK\n", .{});
1705 // std.debug.print("extra = {any}\n", .{extra});
1706 // std.debug.print("outer_decl = {any}\n", .{self.types.items[type_index]});
1707 // std.debug.print("ast_lines = {}\n", .{ast_line});
1708 // std.debug.print("{s}\n", .{sep});
1704 // log.debug("{s}", .{sep});
1705 // log.debug("SWITCH BLOCK", .{});
1706 // log.debug("extra = {any}", .{extra});
1707 // log.debug("outer_decl = {any}", .{self.types.items[type_index]});
1708 // log.debug("ast_lines = {}", .{ast_line});
1709 // log.debug("{s}", .{sep});
17091710
17101711 const switch_index = self.exprs.items.len;
17111712 try self.exprs.append(self.arena, .{ .switchOp = .{ .cond_index = cond_index, .file_name = file.sub_file_path, .ast = ast_index, .outer_decl = type_index } });
......@@ -1728,11 +1729,11 @@ fn walkInstruction(
17281729
17291730 // const ast_index = self.ast_nodes.items.len;
17301731 // const sep = "=" ** 200;
1731 // std.debug.print("{s}\n", .{sep});
1732 // std.debug.print("SWITCH COND\n", .{});
1733 // std.debug.print("ast index = {}\n", .{ast_index});
1734 // std.debug.print("ast previous = {}\n", .{self.ast_nodes.items[ast_index - 1]});
1735 // std.debug.print("{s}\n", .{sep});
1732 // log.debug("{s}", .{sep});
1733 // log.debug("SWITCH COND", .{});
1734 // log.debug("ast index = {}", .{ast_index});
1735 // log.debug("ast previous = {}", .{self.ast_nodes.items[ast_index - 1]});
1736 // log.debug("{s}", .{sep});
17361737
17371738 return DocData.WalkResult{
17381739 .typeRef = operand.typeRef,
......@@ -2209,12 +2210,12 @@ fn walkInstruction(
22092210 _ = decls_bits;
22102211
22112212 // const sep = "=" ** 200;
2212 // std.debug.print("{s}\n", .{sep});
2213 // std.debug.print("small = {any}\n", .{small});
2214 // std.debug.print("src_node = {}\n", .{src_node});
2215 // std.debug.print("decls_len = {}\n", .{decls_len});
2216 // std.debug.print("decls_bit = {}\n", .{decls_bits});
2217 // std.debug.print("{s}\n", .{sep});
2213 // log.debug("{s}", .{sep});
2214 // log.debug("small = {any}", .{small});
2215 // log.debug("src_node = {}", .{src_node});
2216 // log.debug("decls_len = {}", .{decls_len});
2217 // log.debug("decls_bit = {}", .{decls_bits});
2218 // log.debug("{s}", .{sep});
22182219 const type_slot_index = self.types.items.len - 1;
22192220 try self.types.append(self.arena, .{ .Opaque = .{ .name = "TODO" } });
22202221 return DocData.WalkResult{
......@@ -3860,9 +3861,7 @@ fn getBlockInlineBreak(zir: Zir, inst_index: usize) Zir.Inst.Ref {
38603861}
38613862
38623863fn printWithContext(file: *File, inst: usize, comptime fmt: []const u8, args: anytype) void {
3863 std.debug.print("Context [{s}] % {}\n", .{ file.sub_file_path, inst });
3864 std.debug.print(fmt, args);
3865 std.debug.print("\n", .{});
3864 log.debug("Context [{s}] % {} \n " ++ fmt, .{ file.sub_file_path, inst } ++ args);
38663865}
38673866
38683867fn panicWithContext(file: *File, inst: usize, comptime fmt: []const u8, args: anytype) noreturn {