From fb65c2ae35bbf2e548a61c3789a5543efdfe1a73 Mon Sep 17 00:00:00 2001 From: clickingbuttons Date: Fri, 7 Jul 2023 16:07:05 -0400 Subject: [PATCH] Hoist no-emit-bin check to prevent crash --- src/link.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/link.zig b/src/link.zig index 148138a149a4..077b3105f931 100644 --- a/src/link.zig +++ b/src/link.zig @@ -766,8 +766,8 @@ pub const File = struct { assert(base.tag == .c); return @fieldParentPtr(C, "base", base).flush(comp, prog_node); } + const emit = base.options.emit orelse return; // -fno-emit-bin if (comp.clang_preprocessor_mode == .yes) { - const emit = base.options.emit orelse return; // -fno-emit-bin // TODO: avoid extra link step when it's just 1 object file (the `zig cc -c` case) // Until then, we do `lld -r -o output.o input.o` even though the output is the same // as the input. For the preprocessing case (`zig cc -E -o foo`) we copy the file