CLI: allow using --debug-compile-errors with zig build

This commit is contained in:
Veikka Tuominen
2022-11-30 19:14:04 +02:00
parent fba33ee58c
commit e4fd9acc2a
3 changed files with 12 additions and 0 deletions
+5
View File
@@ -3778,6 +3778,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
var override_local_cache_dir: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LOCAL_CACHE_DIR");
var child_argv = std.ArrayList([]const u8).init(arena);
var reference_trace: ?u32 = null;
var debug_compile_errors = false;
const argv_index_exe = child_argv.items.len;
_ = try child_argv.addOne();
@@ -3839,6 +3840,9 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
} else if (mem.eql(u8, arg, "-fno-reference-trace")) {
try child_argv.append(arg);
reference_trace = null;
} else if (mem.eql(u8, arg, "--debug-compile-errors")) {
try child_argv.append(arg);
debug_compile_errors = true;
}
}
try child_argv.append(arg);
@@ -3973,6 +3977,7 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi
.use_stage1 = use_stage1,
.cache_mode = .whole,
.reference_trace = reference_trace,
.debug_compile_errors = debug_compile_errors,
}) catch |err| {
fatal("unable to create compilation: {s}", .{@errorName(err)});
};