diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2024-07-19 01:04:59 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-07-19 22:35:33 -0700 |
| commit | 4f742c4cfc3c3134a0d6ebfdfc354286ae97b2c1 (patch) | |
| tree | c20b44dbe98cb8cb7484b19aca727ad2957e42a2 /src/Zcu.zig | |
| parent | b7e48c6bcd99457f84f0043a3f4590a6ac1f4933 (diff) | |
| download | zig-4f742c4cfc3c3134a0d6ebfdfc354286ae97b2c1.tar.gz zig-4f742c4cfc3c3134a0d6ebfdfc354286ae97b2c1.zip | |
dev: introduce dev environments that enable compiler feature sets
Diffstat (limited to 'src/Zcu.zig')
| -rw-r--r-- | src/Zcu.zig | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Zcu.zig b/src/Zcu.zig index dbc2e5a2c4..41311234d2 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -38,6 +38,7 @@ const Alignment = InternPool.Alignment; const AnalUnit = InternPool.AnalUnit; const BuiltinFn = std.zig.BuiltinFn; const LlvmObject = @import("codegen/llvm.zig").Object; +const dev = @import("dev.zig"); comptime { @setEvalBranchQuota(4000); @@ -57,7 +58,7 @@ comp: *Compilation, /// Usually, the LlvmObject is managed by linker code, however, in the case /// that -fno-emit-bin is specified, the linker code never executes, so we /// store the LlvmObject here. -llvm_object: ?*LlvmObject, +llvm_object: if (dev.env.supports(.llvm_backend)) ?*LlvmObject else ?noreturn, /// Pointer to externally managed resource. root_mod: *Package.Module, @@ -2403,10 +2404,7 @@ pub fn deinit(zcu: *Zcu) void { const pt: Zcu.PerThread = .{ .tid = .main, .zcu = zcu }; const gpa = zcu.gpa; - if (zcu.llvm_object) |llvm_object| { - if (build_options.only_c) unreachable; - llvm_object.deinit(); - } + if (zcu.llvm_object) |llvm_object| llvm_object.deinit(); for (zcu.import_table.keys()) |key| { gpa.free(key); @@ -3041,7 +3039,7 @@ pub fn deleteUnitExports(zcu: *Zcu, anal_unit: AnalUnit) void { // `updateExports` on flush). // This case is needed because in some rare edge cases, `Sema` wants to add and delete exports // within a single update. - if (!build_options.only_c) { + if (dev.env.supports(.incremental)) { for (exports, exports_base..) |exp, export_idx| { if (zcu.comp.bin_file) |lf| { lf.deleteExport(exp.exported, exp.opts.name); |
