mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 23:05:24 +00:00
CLI: allow using --debug-compile-errors with zig build
This commit is contained in:
parent
fba33ee58c
commit
e4fd9acc2a
@ -142,6 +142,8 @@ pub fn main() !void {
|
||||
return usageAndErr(builder, false, stderr_stream);
|
||||
};
|
||||
try debug_log_scopes.append(next_arg);
|
||||
} else if (mem.eql(u8, arg, "--debug-compile-errors")) {
|
||||
builder.debug_compile_errors = true;
|
||||
} else if (mem.eql(u8, arg, "--glibc-runtimes")) {
|
||||
builder.glibc_runtimes_dir = nextArg(args, &arg_idx) orelse {
|
||||
std.debug.print("Expected argument after --glibc-runtimes\n\n", .{});
|
||||
|
||||
@ -72,6 +72,7 @@ pub const Builder = struct {
|
||||
pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
|
||||
args: ?[][]const u8 = null,
|
||||
debug_log_scopes: []const []const u8 = &.{},
|
||||
debug_compile_errors: bool = false,
|
||||
|
||||
/// Experimental. Use system Darling installation to run cross compiled macOS build artifacts.
|
||||
enable_darling: bool = false,
|
||||
@ -2686,6 +2687,10 @@ pub const LibExeObjStep = struct {
|
||||
try zig_args.append(log_scope);
|
||||
}
|
||||
|
||||
if (builder.debug_compile_errors) {
|
||||
try zig_args.append("--debug-compile-errors");
|
||||
}
|
||||
|
||||
if (builder.verbose_cimport) zig_args.append("--verbose-cimport") catch unreachable;
|
||||
if (builder.verbose_air) zig_args.append("--verbose-air") catch unreachable;
|
||||
if (builder.verbose_llvm_ir) zig_args.append("--verbose-llvm-ir") catch unreachable;
|
||||
|
||||
@ -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)});
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user