aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-12-05 16:59:50 +0000
committermlugg <mlugg@mlugg.co.uk>2024-12-05 19:58:42 +0000
commit7f3211a101d8763ec5f0009b219f6819dba2cd35 (patch)
treee9bb31b31381f6fe07bf9d2253c4d7d5b56e882f /src/main.zig
parent4d7818a76ad951f0a16c3831b31841430b1368f7 (diff)
downloadzig-7f3211a101d8763ec5f0009b219f6819dba2cd35.tar.gz
zig-7f3211a101d8763ec5f0009b219f6819dba2cd35.zip
compiler: incremental compilation fixes
The previous commit exposed some bugs in incremental compilation. This commit fixes those, and adds a little more logging for debugging incremental compilation. Also, allow `ast-check -t` to dump ZIR when there are non-fatal AstGen errors.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index a6bec502be..628687937c 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -6096,11 +6096,18 @@ fn cmdAstCheck(
var error_bundle = try wip_errors.toOwnedBundle("");
defer error_bundle.deinit(gpa);
error_bundle.renderToStdErr(color.renderOptions());
- process.exit(1);
+
+ if (file.zir.loweringFailed()) {
+ process.exit(1);
+ }
}
if (!want_output_text) {
- return cleanExit();
+ if (file.zir.hasCompileErrors()) {
+ process.exit(1);
+ } else {
+ return cleanExit();
+ }
}
if (!build_options.enable_debug_extensions) {
fatal("-t option only available in builds of zig with debug extensions", .{});
@@ -6144,7 +6151,13 @@ fn cmdAstCheck(
// zig fmt: on
}
- return @import("print_zir.zig").renderAsTextToFile(gpa, &file, io.getStdOut());
+ try @import("print_zir.zig").renderAsTextToFile(gpa, &file, io.getStdOut());
+
+ if (file.zir.hasCompileErrors()) {
+ process.exit(1);
+ } else {
+ return cleanExit();
+ }
}
fn cmdDetectCpu(