diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index b333ffc666..532bfcb9bf 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -24,7 +24,7 @@ const log = std.log.scoped(.codegen); const build_options = @import("build_options"); const GenerateSymbolError = codegen.GenerateSymbolError; -const FnResult = codegen.FnResult; +const Result = codegen.Result; const DebugInfoOutput = codegen.DebugInfoOutput; const bits = @import("bits.zig"); @@ -349,7 +349,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } @@ -392,8 +392,8 @@ pub fn generate( defer function.dbg_info_relocs.deinit(bin_file.allocator); var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -406,8 +406,8 @@ pub fn generate( function.max_end_stack = call_info.stack_byte_count; function.gen() catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -439,14 +439,14 @@ pub fn generate( defer emit.deinit(); emit.emitMir() catch |err| switch (err) { - error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, + error.EmitFail => return Result{ .fail = emit.err_msg.? }, else => |e| return e, }; if (function.err_msg) |em| { - return FnResult{ .fail = em }; + return Result{ .fail = em }; } else { - return FnResult{ .appended = {} }; + return Result{ .appended = {} }; } } diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index fec844a867..38cf86c758 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -23,7 +23,7 @@ const leb128 = std.leb; const log = std.log.scoped(.codegen); const build_options = @import("build_options"); -const FnResult = codegen.FnResult; +const Result = codegen.Result; const GenerateSymbolError = codegen.GenerateSymbolError; const DebugInfoOutput = codegen.DebugInfoOutput; @@ -356,7 +356,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } @@ -399,8 +399,8 @@ pub fn generate( defer function.dbg_info_relocs.deinit(bin_file.allocator); var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -413,8 +413,8 @@ pub fn generate( function.max_end_stack = call_info.stack_byte_count; function.gen() catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -446,14 +446,14 @@ pub fn generate( defer emit.deinit(); emit.emitMir() catch |err| switch (err) { - error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, + error.EmitFail => return Result{ .fail = emit.err_msg.? }, else => |e| return e, }; if (function.err_msg) |em| { - return FnResult{ .fail = em }; + return Result{ .fail = em }; } else { - return FnResult{ .appended = {} }; + return Result{ .appended = {} }; } } diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 2c63f171ad..71dcfef35e 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -22,7 +22,7 @@ const leb128 = std.leb; const log = std.log.scoped(.codegen); const build_options = @import("build_options"); -const FnResult = @import("../../codegen.zig").FnResult; +const Result = @import("../../codegen.zig").Result; const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError; const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput; @@ -225,7 +225,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } @@ -268,8 +268,8 @@ pub fn generate( defer function.exitlude_jump_relocs.deinit(bin_file.allocator); var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -282,8 +282,8 @@ pub fn generate( function.max_end_stack = call_info.stack_byte_count; function.gen() catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -309,14 +309,14 @@ pub fn generate( defer emit.deinit(); emit.emitMir() catch |err| switch (err) { - error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, + error.EmitFail => return Result{ .fail = emit.err_msg.? }, else => |e| return e, }; if (function.err_msg) |em| { - return FnResult{ .fail = em }; + return Result{ .fail = em }; } else { - return FnResult{ .appended = {} }; + return Result{ .appended = {} }; } } diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 943d21c47b..a5ae985442 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -20,7 +20,7 @@ const Emit = @import("Emit.zig"); const Liveness = @import("../../Liveness.zig"); const Type = @import("../../type.zig").Type; const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError; -const FnResult = @import("../../codegen.zig").FnResult; +const Result = @import("../../codegen.zig").Result; const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput; const build_options = @import("build_options"); @@ -265,7 +265,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } @@ -310,8 +310,8 @@ pub fn generate( defer function.exitlude_jump_relocs.deinit(bin_file.allocator); var call_info = function.resolveCallingConventionValues(fn_type, .callee) catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -324,8 +324,8 @@ pub fn generate( function.max_end_stack = call_info.stack_byte_count; function.gen() catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -351,14 +351,14 @@ pub fn generate( defer emit.deinit(); emit.emitMir() catch |err| switch (err) { - error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, + error.EmitFail => return Result{ .fail = emit.err_msg.? }, else => |e| return e, }; if (function.err_msg) |em| { - return FnResult{ .fail = em }; + return Result{ .fail = em }; } else { - return FnResult{ .appended = {} }; + return Result{ .appended = {} }; } } diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index c27639e14a..55cfc1096a 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -627,13 +627,6 @@ test "Wasm - buildOpcode" { try testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64); } -pub const Result = union(enum) { - /// The codegen bytes have been appended to `Context.code` - appended: void, - /// The data is managed externally and are part of the `Result` - externally_managed: []const u8, -}; - /// Hashmap to store generated `WValue` for each `Air.Inst.Ref` pub const ValueTable = std.AutoArrayHashMapUnmanaged(Air.Inst.Ref, WValue); @@ -1171,7 +1164,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: codegen.DebugInfoOutput, -) codegen.GenerateSymbolError!codegen.FnResult { +) codegen.GenerateSymbolError!codegen.Result { _ = src_loc; var code_gen: CodeGen = .{ .gpa = bin_file.allocator, @@ -1190,11 +1183,11 @@ pub fn generate( defer code_gen.deinit(); genFunc(&code_gen) catch |err| switch (err) { - error.CodegenFail => return codegen.FnResult{ .fail = code_gen.err_msg }, + error.CodegenFail => return codegen.Result{ .fail = code_gen.err_msg }, else => |e| return e, }; - return codegen.FnResult{ .appended = {} }; + return codegen.Result{ .appended = {} }; } fn genFunc(func: *CodeGen) InnerError!void { diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 2ad31bf7ba..d68aa81cac 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -16,7 +16,7 @@ const Compilation = @import("../../Compilation.zig"); const DebugInfoOutput = codegen.DebugInfoOutput; const DW = std.dwarf; const ErrorMsg = Module.ErrorMsg; -const FnResult = codegen.FnResult; +const Result = codegen.Result; const GenerateSymbolError = codegen.GenerateSymbolError; const Emit = @import("Emit.zig"); const Liveness = @import("../../Liveness.zig"); @@ -257,7 +257,7 @@ pub fn generate( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } @@ -305,8 +305,8 @@ pub fn generate( defer if (builtin.mode == .Debug) function.mir_to_air_map.deinit(); var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -319,8 +319,8 @@ pub fn generate( function.max_end_stack = call_info.stack_byte_count; function.gen() catch |err| switch (err) { - error.CodegenFail => return FnResult{ .fail = function.err_msg.? }, - error.OutOfRegisters => return FnResult{ + error.CodegenFail => return Result{ .fail = function.err_msg.? }, + error.OutOfRegisters => return Result{ .fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}), }, else => |e| return e, @@ -345,14 +345,14 @@ pub fn generate( }; defer emit.deinit(); emit.lowerMir() catch |err| switch (err) { - error.EmitFail => return FnResult{ .fail = emit.err_msg.? }, + error.EmitFail => return Result{ .fail = emit.err_msg.? }, else => |e| return e, }; if (function.err_msg) |em| { - return FnResult{ .fail = em }; + return Result{ .fail = em }; } else { - return FnResult{ .appended = {} }; + return Result{ .appended = {} }; } } diff --git a/src/codegen.zig b/src/codegen.zig index e8dd661684..1bb0d390e6 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -21,16 +21,9 @@ const TypedValue = @import("TypedValue.zig"); const Value = @import("value.zig").Value; const Zir = @import("Zir.zig"); -pub const FnResult = union(enum) { - /// The `code` parameter passed to `generateSymbol` has the value appended. - appended: void, - fail: *ErrorMsg, -}; pub const Result = union(enum) { /// The `code` parameter passed to `generateSymbol` has the value appended. appended: void, - /// The value is available externally, `code` is unused. - externally_managed: []const u8, fail: *ErrorMsg, }; @@ -89,7 +82,7 @@ pub fn generateFunction( liveness: Liveness, code: *std.ArrayList(u8), debug_output: DebugInfoOutput, -) GenerateSymbolError!FnResult { +) GenerateSymbolError!Result { switch (bin_file.options.target.cpu.arch) { .arm, .armeb, @@ -209,9 +202,6 @@ pub fn generateSymbol( .val = elem_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -230,9 +220,6 @@ pub fn generateSymbol( .val = array, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -243,9 +230,6 @@ pub fn generateSymbol( .val = sentinel_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -260,9 +244,6 @@ pub fn generateSymbol( .val = sentinel_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } return Result{ .appended = {} }; @@ -310,9 +291,6 @@ pub fn generateSymbol( .val = slice.ptr, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } @@ -322,9 +300,6 @@ pub fn generateSymbol( .val = slice.len, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } @@ -376,9 +351,6 @@ pub fn generateSymbol( .val = container_ptr, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } return Result{ .appended = {} }; @@ -552,9 +524,6 @@ pub fn generateSymbol( .appended => { mem.copy(u8, code.items[current_pos..], tmp_list.items); }, - .externally_managed => |external_slice| { - mem.copy(u8, code.items[current_pos..], external_slice); - }, .fail => |em| return Result{ .fail = em }, } } else { @@ -577,9 +546,6 @@ pub fn generateSymbol( .val = field_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } const unpadded_field_end = code.items.len - struct_begin; @@ -613,9 +579,6 @@ pub fn generateSymbol( .val = union_obj.tag, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -633,9 +596,6 @@ pub fn generateSymbol( .val = union_obj.val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } @@ -651,9 +611,6 @@ pub fn generateSymbol( .val = union_obj.tag, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -679,9 +636,6 @@ pub fn generateSymbol( .val = payload.data, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } } else if (!typed_value.val.isNull()) { @@ -690,9 +644,6 @@ pub fn generateSymbol( .val = typed_value.val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } } else { @@ -709,9 +660,6 @@ pub fn generateSymbol( .val = value, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } @@ -741,9 +689,6 @@ pub fn generateSymbol( .val = if (is_payload) Value.initTag(.zero) else typed_value.val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -757,9 +702,6 @@ pub fn generateSymbol( .val = payload_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } const unpadded_end = code.items.len - begin; @@ -779,9 +721,6 @@ pub fn generateSymbol( .val = if (is_payload) Value.initTag(.zero) else typed_value.val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } const unpadded_end = code.items.len - begin; @@ -826,9 +765,6 @@ pub fn generateSymbol( .val = elem_val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -846,9 +782,6 @@ pub fn generateSymbol( .val = array, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |slice| { - code.appendSliceAssumeCapacity(slice); - }, .fail => |em| return Result{ .fail = em }, } } @@ -902,9 +835,6 @@ fn lowerDeclRef( .val = typed_value.val, }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } @@ -918,9 +848,6 @@ fn lowerDeclRef( .val = Value.initPayload(&slice_len.base), }, code, debug_output, reloc_info)) { .appended => {}, - .externally_managed => |external_slice| { - code.appendSliceAssumeCapacity(external_slice); - }, .fail => |em| return Result{ .fail = em }, } diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 9c05114a1f..90073cf5ae 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -981,7 +981,6 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In .parent_atom_index = atom.sym_index, }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; @@ -1042,7 +1041,6 @@ pub fn updateDecl(self: *Coff, module: *Module, decl_index: Module.Decl.Index) ! .parent_atom_index = decl.link.coff.sym_index, }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 48e0320dc6..db84cc38f7 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2553,7 +2553,6 @@ pub fn updateDecl(self: *Elf, module: *Module, decl_index: Module.Decl.Index) !v }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; @@ -2618,7 +2617,6 @@ pub fn lowerUnnamedConst(self: *Elf, typed_value: TypedValue, decl_index: Module .parent_atom_index = atom.local_sym_index, }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; diff --git a/src/link/MachO.zig b/src/link/MachO.zig index e6924a6717..252df865d0 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2082,7 +2082,6 @@ pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: Modu .parent_atom_index = atom.sym_index, }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; @@ -2167,7 +2166,6 @@ pub fn updateDecl(self: *MachO, module: *Module, decl_index: Module.Decl.Index) }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 5423269bf0..3a76139fe1 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -358,7 +358,6 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: Module.Decl.I .parent_atom_index = @enumToInt(decl_index), }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; @@ -403,7 +402,6 @@ pub fn updateDecl(self: *Plan9, module: *Module, decl_index: Module.Decl.Index) .parent_atom_index = @enumToInt(decl_index), }); const code = switch (res) { - .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 7154cd7bc1..f11a052f45 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -1113,7 +1113,6 @@ pub fn updateDecl(wasm: *Wasm, mod: *Module, decl_index: Module.Decl.Index) !voi ); const code = switch (res) { - .externally_managed => |x| x, .appended => code_writer.items, .fail => |em| { decl.analysis = .codegen_failure; @@ -1250,7 +1249,6 @@ pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: Module.Decl.In }, ); const code = switch (result) { - .externally_managed => |x| x, .appended => value_bytes.items, .fail => |em| { decl.analysis = .codegen_failure;