| ... | @@ -7,6 +7,7 @@ const File = Module.File; | ... | @@ -7,6 +7,7 @@ const File = Module.File; |
| 7 | const Package = @import("Package.zig"); | 7 | const Package = @import("Package.zig"); |
| 8 | const Zir = @import("Zir.zig"); | 8 | const Zir = @import("Zir.zig"); |
| 9 | const Ref = Zir.Inst.Ref; | 9 | const Ref = Zir.Inst.Ref; |
| | 10 | const log = std.log.scoped(.autodoc); |
| 10 | | 11 | |
| 11 | module: *Module, | 12 | module: *Module, |
| 12 | doc_location: Compilation.EmitLoc, | 13 | doc_location: Compilation.EmitLoc, |
| ... | @@ -62,7 +63,7 @@ pub fn deinit(_: *Autodoc) void { | ... | @@ -62,7 +63,7 @@ pub fn deinit(_: *Autodoc) void { |
| 62 | pub fn generateZirData(self: *Autodoc) !void { | 63 | pub fn generateZirData(self: *Autodoc) !void { |
| 63 | if (self.doc_location.directory) |dir| { | 64 | if (self.doc_location.directory) |dir| { |
| 64 | if (dir.path) |path| { | 65 | if (dir.path) |path| { |
| 65 | std.debug.print("path: {s}\n", .{path}); | 66 | log.debug("path: {s}", .{path}); |
| 66 | } | 67 | } |
| 67 | } | 68 | } |
| 68 | | 69 | |
| ... | @@ -1700,12 +1701,12 @@ fn walkInstruction( | ... | @@ -1700,12 +1701,12 @@ fn walkInstruction( |
| 1700 | // const ast_line = self.ast_nodes.items[ast_index - 1]; | 1701 | // const ast_line = self.ast_nodes.items[ast_index - 1]; |
| 1701 | | 1702 | |
| 1702 | // const sep = "=" ** 200; | 1703 | // const sep = "=" ** 200; |
| 1703 | // std.debug.print("{s}\n", .{sep}); | 1704 | // log.debug("{s}", .{sep}); |
| 1704 | // std.debug.print("SWITCH BLOCK\n", .{}); | 1705 | // log.debug("SWITCH BLOCK", .{}); |
| 1705 | // std.debug.print("extra = {any}\n", .{extra}); | 1706 | // log.debug("extra = {any}", .{extra}); |
| 1706 | // std.debug.print("outer_decl = {any}\n", .{self.types.items[type_index]}); | 1707 | // log.debug("outer_decl = {any}", .{self.types.items[type_index]}); |
| 1707 | // std.debug.print("ast_lines = {}\n", .{ast_line}); | 1708 | // log.debug("ast_lines = {}", .{ast_line}); |
| 1708 | // std.debug.print("{s}\n", .{sep}); | 1709 | // log.debug("{s}", .{sep}); |
| 1709 | | 1710 | |
| 1710 | const switch_index = self.exprs.items.len; | 1711 | const switch_index = self.exprs.items.len; |
| 1711 | try self.exprs.append(self.arena, .{ .switchOp = .{ .cond_index = cond_index, .file_name = file.sub_file_path, .ast = ast_index, .outer_decl = type_index } }); | 1712 | 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( | ... | @@ -1728,11 +1729,11 @@ fn walkInstruction( |
| 1728 | | 1729 | |
| 1729 | // const ast_index = self.ast_nodes.items.len; | 1730 | // const ast_index = self.ast_nodes.items.len; |
| 1730 | // const sep = "=" ** 200; | 1731 | // const sep = "=" ** 200; |
| 1731 | // std.debug.print("{s}\n", .{sep}); | 1732 | // log.debug("{s}", .{sep}); |
| 1732 | // std.debug.print("SWITCH COND\n", .{}); | 1733 | // log.debug("SWITCH COND", .{}); |
| 1733 | // std.debug.print("ast index = {}\n", .{ast_index}); | 1734 | // log.debug("ast index = {}", .{ast_index}); |
| 1734 | // std.debug.print("ast previous = {}\n", .{self.ast_nodes.items[ast_index - 1]}); | 1735 | // log.debug("ast previous = {}", .{self.ast_nodes.items[ast_index - 1]}); |
| 1735 | // std.debug.print("{s}\n", .{sep}); | 1736 | // log.debug("{s}", .{sep}); |
| 1736 | | 1737 | |
| 1737 | return DocData.WalkResult{ | 1738 | return DocData.WalkResult{ |
| 1738 | .typeRef = operand.typeRef, | 1739 | .typeRef = operand.typeRef, |
| ... | @@ -2209,12 +2210,12 @@ fn walkInstruction( | ... | @@ -2209,12 +2210,12 @@ fn walkInstruction( |
| 2209 | _ = decls_bits; | 2210 | _ = decls_bits; |
| 2210 | | 2211 | |
| 2211 | // const sep = "=" ** 200; | 2212 | // const sep = "=" ** 200; |
| 2212 | // std.debug.print("{s}\n", .{sep}); | 2213 | // log.debug("{s}", .{sep}); |
| 2213 | // std.debug.print("small = {any}\n", .{small}); | 2214 | // log.debug("small = {any}", .{small}); |
| 2214 | // std.debug.print("src_node = {}\n", .{src_node}); | 2215 | // log.debug("src_node = {}", .{src_node}); |
| 2215 | // std.debug.print("decls_len = {}\n", .{decls_len}); | 2216 | // log.debug("decls_len = {}", .{decls_len}); |
| 2216 | // std.debug.print("decls_bit = {}\n", .{decls_bits}); | 2217 | // log.debug("decls_bit = {}", .{decls_bits}); |
| 2217 | // std.debug.print("{s}\n", .{sep}); | 2218 | // log.debug("{s}", .{sep}); |
| 2218 | const type_slot_index = self.types.items.len - 1; | 2219 | const type_slot_index = self.types.items.len - 1; |
| 2219 | try self.types.append(self.arena, .{ .Opaque = .{ .name = "TODO" } }); | 2220 | try self.types.append(self.arena, .{ .Opaque = .{ .name = "TODO" } }); |
| 2220 | return DocData.WalkResult{ | 2221 | return DocData.WalkResult{ |
| ... | @@ -3860,9 +3861,7 @@ fn getBlockInlineBreak(zir: Zir, inst_index: usize) Zir.Inst.Ref { | ... | @@ -3860,9 +3861,7 @@ fn getBlockInlineBreak(zir: Zir, inst_index: usize) Zir.Inst.Ref { |
| 3860 | } | 3861 | } |
| 3861 | | 3862 | |
| 3862 | fn printWithContext(file: *File, inst: usize, comptime fmt: []const u8, args: anytype) void { | 3863 | fn 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 | log.debug("Context [{s}] % {} \n " ++ fmt, .{ file.sub_file_path, inst } ++ args); |
| 3864 | std.debug.print(fmt, args); | | |
| 3865 | std.debug.print("\n", .{}); | | |
| 3866 | } | 3865 | } |
| 3867 | | 3866 | |
| 3868 | fn panicWithContext(file: *File, inst: usize, comptime fmt: []const u8, args: anytype) noreturn { | 3867 | fn panicWithContext(file: *File, inst: usize, comptime fmt: []const u8, args: anytype) noreturn { |