diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-03-14 16:12:24 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-03-15 10:48:15 -0700 |
| commit | 363d4a107de3af95620f82e851e8777aa9f576c9 (patch) | |
| tree | 14a7536caf8366329f0f2f9286fa539d0fab3db2 /src | |
| parent | ed33901218363b9d1baee4c37e85f573dc034e06 (diff) | |
| download | zig-363d4a107de3af95620f82e851e8777aa9f576c9.tar.gz zig-363d4a107de3af95620f82e851e8777aa9f576c9.zip | |
add compile log output to build runner
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compilation.zig | 8 | ||||
| -rw-r--r-- | src/Sema.zig | 2 | ||||
| -rw-r--r-- | src/main.zig | 18 |
3 files changed, 10 insertions, 18 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index ec21d2c483..89512ce744 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2705,7 +2705,8 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { assert(self.totalErrorCount() == bundle.root_list.items.len); - return bundle.toOwnedBundle(); + const compile_log_text = if (self.bin_file.options.module) |m| m.compile_log_text.items else ""; + return bundle.toOwnedBundle(compile_log_text); } pub const ErrorNoteHashContext = struct { @@ -2954,11 +2955,6 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { } } -pub fn getCompileLogOutput(self: *Compilation) []const u8 { - const module = self.bin_file.options.module orelse return &[0]u8{}; - return module.compile_log_text.items; -} - pub fn performAllTheWork( comp: *Compilation, main_progress_node: *std.Progress.Node, diff --git a/src/Sema.zig b/src/Sema.zig index c9f4f27fe2..fc39fbb9fc 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2219,7 +2219,7 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { wip_errors.init(gpa) catch unreachable; Compilation.addModuleErrorMsg(&wip_errors, err_msg.*) catch unreachable; std.debug.print("compile error during Sema:\n", .{}); - var error_bundle = wip_errors.toOwnedBundle() catch unreachable; + var error_bundle = wip_errors.toOwnedBundle("") catch unreachable; error_bundle.renderToStdErr(.{ .ttyconf = .no_color }); crash_report.compilerPanic("unexpected compile error occurred", null, null); } diff --git a/src/main.zig b/src/main.zig index 19f1a6e52c..e7d5c647b5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3886,10 +3886,6 @@ fn updateModule(gpa: Allocator, comp: *Compilation, hook: AfterUpdateHook) !void if (errors.errorMessageCount() > 0) { errors.renderToStdErr(renderOptions(comp.color)); - const log_text = comp.getCompileLogOutput(); - if (log_text.len != 0) { - std.debug.print("\nCompile Log Output:\n{s}", .{log_text}); - } return error.SemanticAnalyzeFail; } else switch (hook) { .none => {}, @@ -4512,7 +4508,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi &all_modules, ); if (wip_errors.root_list.items.len > 0) { - var errors = try wip_errors.toOwnedBundle(); + var errors = try wip_errors.toOwnedBundle(""); defer errors.deinit(gpa); errors.renderToStdErr(renderOptions(color)); process.exit(1); @@ -4775,7 +4771,7 @@ pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void try wip_errors.init(gpa); defer wip_errors.deinit(); try Compilation.addZirErrorMessages(&wip_errors, &file); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(color)); process.exit(2); @@ -4981,7 +4977,7 @@ fn fmtPathFile( try wip_errors.init(gpa); defer wip_errors.deinit(); try Compilation.addZirErrorMessages(&wip_errors, &file); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(fmt.color)); fmt.any_error = true; @@ -5018,7 +5014,7 @@ fn printAstErrorsToStderr(gpa: Allocator, tree: Ast, path: []const u8, color: Co try putAstErrorsIntoBundle(gpa, tree, path, &wip_errors); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(color)); } @@ -5622,7 +5618,7 @@ pub fn cmdAstCheck( try wip_errors.init(gpa); defer wip_errors.deinit(); try Compilation.addZirErrorMessages(&wip_errors, &file); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(color)); process.exit(1); @@ -5739,7 +5735,7 @@ pub fn cmdChangelist( try wip_errors.init(gpa); defer wip_errors.deinit(); try Compilation.addZirErrorMessages(&wip_errors, &file); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(color)); process.exit(1); @@ -5774,7 +5770,7 @@ pub fn cmdChangelist( try wip_errors.init(gpa); defer wip_errors.deinit(); try Compilation.addZirErrorMessages(&wip_errors, &file); - var error_bundle = try wip_errors.toOwnedBundle(); + var error_bundle = try wip_errors.toOwnedBundle(""); defer error_bundle.deinit(gpa); error_bundle.renderToStdErr(renderOptions(color)); process.exit(1); |
