From d69634c10d2e4ca4af834a0644136ac1af72cd26 Mon Sep 17 00:00:00 2001 From: Robbie Lyman Date: Fri, 28 Aug 2026 20:15:22 -0400 Subject: [PATCH] chore(MultiArrayList): update .{} to .empty This change brings initiailization of MultiArrayList within the compiler and the standard library in line with other std containers in preferring the `.empty` decl literal over `.{}` initialization. --- lib/compiler/Maker/Watch.zig | 20 ++++++++++---------- lib/compiler/aro/aro/CodeGen.zig | 2 +- lib/compiler/aro/aro/Hideset.zig | 6 +++--- lib/compiler/aro/backend/Ir.zig | 2 +- lib/std/array_hash_map.zig | 8 ++++---- lib/std/multi_array_list.zig | 4 ++-- lib/std/zig/AstGen.zig | 2 +- lib/std/zig/llvm/Builder.zig | 4 ++-- src/Sema.zig | 20 ++++++++++---------- src/Zcu.zig | 4 ++-- src/Zcu/PerThread.zig | 4 ++-- src/codegen/llvm/FuncGen.zig | 2 +- src/codegen/riscv64/CodeGen.zig | 12 ++++++------ src/codegen/sparc64/CodeGen.zig | 4 ++-- src/codegen/wasm/CodeGen.zig | 2 +- src/link/Elf.zig | 4 ++-- src/link/Elf/ZigObject.zig | 10 +++++----- src/link/MachO.zig | 4 ++-- src/link/MachO/Dylib.zig | 2 +- src/link/MachO/InternalObject.zig | 2 +- src/link/MachO/Object.zig | 4 ++-- src/link/MachO/ZigObject.zig | 8 ++++---- src/link/MachO/dyld_info/Trie.zig | 2 +- src/link/Spork8.zig | 2 +- 24 files changed, 67 insertions(+), 67 deletions(-) diff --git a/lib/compiler/Maker/Watch.zig b/lib/compiler/Maker/Watch.zig index 563c74a64e5edb1397e25c7a17b4ba9439d8d314..a6b8cf379f37c437117ae8a6f4ad65351cd8765f 100644 --- a/lib/compiler/Maker/Watch.zig +++ b/lib/compiler/Maker/Watch.zig @@ -110,12 +110,12 @@ const Os = switch (builtin.os.tag) { fn init(maker: *Maker) !Watch { return .{ - .dir_table = .{}, + .dir_table = .empty, .dir_count = 0, .os = switch (builtin.os.tag) { .linux => .{ - .handle_table = .{}, - .poll_fds = .{}, + .handle_table = .empty, + .poll_fds = .empty, }, else => {}, }, @@ -248,7 +248,7 @@ const Os = switch (builtin.os.tag) { _ = w.dir_table.pop(); } else { assert(dh_gop.index == gop.index); - dh_gop.value_ptr.* = .{ .mount_id = mount_id, .reaction_set = .{} }; + dh_gop.value_ptr.* = .{ .mount_id = mount_id, .reaction_set = .empty }; posix.fanotify_mark(fan_fd, .{ .ADD = true, .ONLYDIR = true, @@ -261,7 +261,7 @@ const Os = switch (builtin.os.tag) { }; for (files.items) |basename| { const gop = try reaction_set.getOrPut(gpa, basename); - if (!gop.found_existing) gop.value_ptr.* = .{}; + if (!gop.found_existing) gop.value_ptr.* = .empty; try gop.value_ptr.put(gpa, step_index, w.generation); } } @@ -488,7 +488,7 @@ const Os = switch (builtin.os.tag) { fn init(maker: *Maker) !Watch { return .{ - .dir_table = .{}, + .dir_table = .empty, .dir_count = 0, .os = switch (builtin.os.tag) { .windows => .{ @@ -610,7 +610,7 @@ const Os = switch (builtin.os.tag) { }; for (files.items) |basename| { const gop = try dir.reaction_set.getOrPut(gpa, basename); - if (!gop.found_existing) gop.value_ptr.* = .{}; + if (!gop.found_existing) gop.value_ptr.* = .empty; try gop.value_ptr.put(gpa, step_index, w.generation); } } @@ -713,7 +713,7 @@ const Os = switch (builtin.os.tag) { fn init(maker: *Maker) !Watch { return .{ - .dir_table = .{}, + .dir_table = .empty, .dir_count = 0, .os = .{ .kq_fd = try Io.Kqueue.createFileDescriptor(), @@ -769,7 +769,7 @@ const Os = switch (builtin.os.tag) { _ = try Io.Kqueue.kevent(w.os.kq_fd, &changes, &.{}, null); assert(handles.len == gop.index); try handles.append(gpa, .{ - .rs = .{}, + .rs = .empty, .dir_fd = if (skip_open_dir) -1 else dir_fd, }); } @@ -778,7 +778,7 @@ const Os = switch (builtin.os.tag) { }; for (files.items) |basename| { const gop = try reaction_set.getOrPut(gpa, basename); - if (!gop.found_existing) gop.value_ptr.* = .{}; + if (!gop.found_existing) gop.value_ptr.* = .empty; try gop.value_ptr.put(gpa, step_index, w.generation); } } diff --git a/lib/compiler/aro/aro/CodeGen.zig b/lib/compiler/aro/aro/CodeGen.zig index 26af158988e9b72706296bd0a623b973d039c3bb..b1de0586ba55503082cb6afc0cffabdbb2fd7160 100644 --- a/lib/compiler/aro/aro/CodeGen.zig +++ b/lib/compiler/aro/aro/CodeGen.zig @@ -17,7 +17,7 @@ const QualType = @import("TypeStore.zig").QualType; const Value = @import("Value.zig"); const WipSwitch = struct { - cases: Cases = .{}, + cases: Cases = .empty, default: ?Ir.Ref = null, size: u64, diff --git a/lib/compiler/aro/aro/Hideset.zig b/lib/compiler/aro/aro/Hideset.zig index fa53f72692c83c4001356710e3c86ffb8fcfc092..0b2920b5903f79044486d6009ebc73610d2cf6af 100644 --- a/lib/compiler/aro/aro/Hideset.zig +++ b/lib/compiler/aro/aro/Hideset.zig @@ -41,11 +41,11 @@ pub const Index = enum(u32) { _, }; -map: std.AutoHashMapUnmanaged(Identifier, Index) = .{}, +map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty, /// Used for computing union/intersection of two lists; stored here so that allocations can be retained /// until hideset is deinit'ed -tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{}, -linked_list: Item.List = .{}, +tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty, +linked_list: Item.List = .empty, comp: *const Compilation, /// Invalidated if the underlying MultiArrayList slice is reallocated due to resize diff --git a/lib/compiler/aro/backend/Ir.zig b/lib/compiler/aro/backend/Ir.zig index b95e71cc13d6e88b723db0282c5c09d791bd29c5..17fa7fd60208687088a020bb28c557b548b33d3c 100644 --- a/lib/compiler/aro/backend/Ir.zig +++ b/lib/compiler/aro/backend/Ir.zig @@ -179,7 +179,7 @@ pub const Renderer = struct { gpa: Allocator, obj: *Object, ir: *const Ir, - errors: ErrorList = .{}, + errors: ErrorList = .empty, pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8); diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig index 2152796e1cc66d10dfdcf4fae07a2f8de840e643..a184839a1ba179631a780292a71e76557ca4befc 100644 --- a/lib/std/array_hash_map.zig +++ b/lib/std/array_hash_map.zig @@ -87,7 +87,7 @@ pub fn Custom( return struct { /// It is permitted to access this field directly. /// After any modification to the keys, consider calling `reIndex`. - entries: DataList = .{}, + entries: DataList = .empty, /// When entries length is less than `linear_scan_max`, this remains `null`. /// Once entries length grows big enough, this field is allocated. There is @@ -100,7 +100,7 @@ pub fn Custom( /// A map containing no keys or values. pub const empty: Self = .{ - .entries = .{}, + .entries = .empty, .index_header = null, }; @@ -165,7 +165,7 @@ pub fn Custom( const Oom = Allocator.Error; pub fn init(gpa: Allocator, key_list: []const K, value_list: []const V) Oom!Self { - var self: Self = .{}; + var self: Self = .empty; errdefer self.deinit(gpa); try self.reinit(gpa, key_list, value_list); return self; @@ -836,7 +836,7 @@ pub fn Custom( return self.cloneContext(gpa, undefined); } pub fn cloneContext(self: Self, gpa: Allocator, ctx: Context) Oom!Self { - var other: Self = .{}; + var other: Self = .empty; other.entries = try self.entries.clone(gpa); errdefer other.entries.deinit(gpa); diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index ce6265655eb690499577bc7fbd29c19eab375854..26c722bc6cd98d267027a63c13cd76dea009e2a9 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -227,7 +227,7 @@ pub fn MultiArrayList(comptime T: type) type { /// The caller owns the returned memory. Empties this MultiArrayList. pub fn toOwnedSlice(self: *Self) Slice { const result = self.slice(); - self.* = .{}; + self.* = .empty; return result; } @@ -496,7 +496,7 @@ pub fn MultiArrayList(comptime T: type) type { pub fn clearAndFree(self: *Self, gpa: Allocator) void { gpa.free(self.allocatedBytes()); - self.* = .{}; + self.* = .empty; } /// Reduce length to `new_len`. diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index bb3cda94038be396c53bde1984d8449a7544ee38..9c5bf6b2b85e2613250be9bc01acad380c45ebb2 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -21,7 +21,7 @@ tree: *const Ast, /// The set of nodes which, given the choice, must expose a result pointer to /// sub-expressions. See `AstRlAnnotate` for details. nodes_need_rl: *const AstRlAnnotate.RlNeededSet, -instructions: std.MultiArrayList(Zir.Inst) = .{}, +instructions: std.MultiArrayList(Zir.Inst) = .empty, extra: ArrayList(u32) = .empty, string_bytes: ArrayList(u8) = .empty, /// Tracks the current byte offset within the source file. diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index 88431b1a0d31ec56db89d3cadc048f81fb2e1bb8..25f2950ab1cb634eda06a56445edec4a917dcb7a 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -1429,7 +1429,7 @@ pub const Type = enum(u32) { } pub fn isSized(self: Type, builder: *const Builder) Allocator.Error!bool { - var visited: IsSizedVisited = .{}; + var visited: IsSizedVisited = .empty; defer visited.deinit(builder.gpa); const result = try self.isSizedVisited(&visited, builder); return result; @@ -14710,7 +14710,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco var attributes_set: std.array_hash_map.Auto(struct { attributes: Attributes, index: u32, - }, void) = .{}; + }, void) = .empty; defer attributes_set.deinit(self.gpa); // PARAMATTR_GROUP_BLOCK diff --git a/src/Sema.zig b/src/Sema.zig index bf12c2b5840e4537f6328f3b14de51ebe062430a..8dda937f375e048096e7b345372c5ae42d2c0b8f 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -44,7 +44,7 @@ gpa: Allocator, /// This arena will be cleared when the sema is destroyed. arena: Allocator, code: Zir, -air_instructions: std.MultiArrayList(Air.Inst) = .{}, +air_instructions: std.MultiArrayList(Air.Inst) = .empty, air_extra: std.ArrayList(u32) = .empty, /// Maps ZIR to AIR. inst_map: InstMap = .{}, @@ -161,7 +161,7 @@ const MaybeComptimeAlloc = struct { stores: std.MultiArrayList(struct { inst: Air.Inst.Index, src: LazySrcLoc, - }) = .{}, + }) = .empty, }; const ComptimeAlloc = struct { @@ -214,7 +214,7 @@ pub const InferredErrorSet = struct { /// All currently known errors that this error set contains. This includes /// direct additions via `return error.Foo;`, and possibly also errors that /// are returned from any dependent functions. - errors: NameMap = .{}, + errors: NameMap = .empty, /// Other inferred error sets which this inferred error set should include. inferred_error_sets: std.array_hash_map.Auto(InternPool.Index, void) = .empty, /// The regular error set created by resolving this inferred error set. @@ -363,7 +363,7 @@ pub const Block = struct { /// function type. /// This memory is allocated by a parent `Sema` in the temporary arena, and is /// used to add a `func_instance` into the `InternPool`. - params: std.MultiArrayList(Param) = .{}, + params: std.MultiArrayList(Param) = .empty, label: ?*Label = null, inlining: ?*Inlining, @@ -3038,7 +3038,7 @@ fn zirErrorSetDecl( const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); - var names: InferredErrorSet.NameMap = .{}; + var names: InferredErrorSet.NameMap = .empty; try names.ensureUnusedCapacity(sema.arena, extra.data.fields_len); var extra_index: u32 = @intCast(extra.end); @@ -8440,7 +8440,7 @@ fn resolveGenericBody( // Make sure any nested param instructions don't clobber our work. const prev_params = block.params; - block.params = .{}; + block.params = .empty; defer { block.params = prev_params; } @@ -9108,7 +9108,7 @@ fn zirParam( const param_ty: Type = if (extra.data.type.is_generic) .generic_poison else ty: { // Make sure any nested param instructions don't clobber our work. const prev_params = block.params; - block.params = .{}; + block.params = .empty; defer { block.params = prev_params; } @@ -11542,7 +11542,7 @@ fn validateSwitchBlock( ); } - var names: InferredErrorSet.NameMap = .{}; + var names: InferredErrorSet.NameMap = .empty; try names.ensureUnusedCapacity(sema.arena, error_names.len); for (error_names.get(ip)) |error_name| { if (seen.errors.contains(error_name)) continue; @@ -12177,7 +12177,7 @@ fn analyzeSwitchCaptures( break :payload_ref try sema.errorCastUnchecked(case_block, capture_err_ty, loaded_operand); }, .item_refs => |item_refs| { - var names: InferredErrorSet.NameMap = .{}; + var names: InferredErrorSet.NameMap = .empty; try names.ensureUnusedCapacity(sema.arena, item_refs.len); for (item_refs) |item_ref| { const item_val = sema.resolveValue(item_ref).?; @@ -34511,7 +34511,7 @@ fn errorSetMerge(sema: *Sema, lhs: Type, rhs: Type) !Type { const arena = sema.arena; const lhs_names = lhs.errorSetNames(pt.zcu); const rhs_names = rhs.errorSetNames(pt.zcu); - var names: InferredErrorSet.NameMap = .{}; + var names: InferredErrorSet.NameMap = .empty; try names.ensureUnusedCapacity(arena, lhs_names.len); for (0..lhs_names.len) |lhs_index| { diff --git a/src/Zcu.zig b/src/Zcu.zig index 4a8936e3961f109c07f59c38583bcc574633c7a2..c9bf50b2b7f14400c0b524915b23da0b93ecc961 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -102,7 +102,7 @@ single_exports: std.array_hash_map.Auto(AnalUnit, Export.Index) = .empty, multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct { index: u32, len: u32, -}) = .{}, +}) = .empty, /// Key is the digest returned by `Builtin.hash`; value is the corresponding module. builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Module) = .empty, @@ -3050,7 +3050,7 @@ pub fn loadZirCache(gpa: Allocator, io: Io, cache_file: Io.File) !Zir { } pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader) !Zir { - var instructions: std.MultiArrayList(Zir.Inst) = .{}; + var instructions: std.MultiArrayList(Zir.Inst) = .empty; errdefer instructions.deinit(gpa); try instructions.setCapacity(gpa, header.instructions_len); diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index e8bf4fbc9967e6ef357c4e9dc9af47b017c274b9..ec764ddfdefc972b4ff9bfbc3d8a920cdabe9762 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -817,7 +817,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { try updated_files.putNoClobber(gpa, file_index, .{ .file = file, // We intentionally don't map any instructions here; that's the point, the whole file is outdated! - .inst_map = .{}, + .inst_map = .empty, }); continue; } @@ -837,7 +837,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { assert(!gop.found_existing); gop.value_ptr.* = .{ .file = file, - .inst_map = .{}, + .inst_map = .empty, }; try Zcu.mapOldZirToNew(gpa, old_zir, new_zir, &gop.value_ptr.inst_map); } diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index 8e8ec3e1d1e81a44efaed7843ba3ec5c70cae1c4..034e5c634dcbc82ef3a762c7da25ed3ef5eca89c 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -1360,7 +1360,7 @@ fn lowerBlock( const have_block_result = inst_ty.hasRuntimeBits(zcu); - var breaks: BreakList = if (have_block_result) .{ .list = .{} } else .{ .len = 0 }; + var breaks: BreakList = if (have_block_result) .{ .list = .empty } else .{ .len = 0 }; defer if (have_block_result) breaks.list.deinit(self.gpa); const parent_bb = try self.wip.block(0, "Block"); diff --git a/src/codegen/riscv64/CodeGen.zig b/src/codegen/riscv64/CodeGen.zig index 84e714fa11953fe023980ed079f3d90adf89dc49..55a1e138d1ab01c5744f1ff7cb3f3c8181b8c715 100644 --- a/src/codegen/riscv64/CodeGen.zig +++ b/src/codegen/riscv64/CodeGen.zig @@ -78,7 +78,7 @@ func_index: InternPool.Index, fn_type: Type, arg_index: usize, -mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, +mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, owner: Owner, @@ -112,19 +112,19 @@ vtype: ?bits.VType, blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, -const_tracking: ConstTrackingMap = .{}, -inst_tracking: InstTrackingMap = .{}, +const_tracking: ConstTrackingMap = .empty, +inst_tracking: InstTrackingMap = .empty, -frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, +frame_allocs: std.MultiArrayList(FrameAlloc) = .empty, free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty, -frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, +frame_locs: std.MultiArrayList(Mir.FrameLoc) = .empty, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { /// The state to restore before branching. state: State, /// The branch target. jmp_target: Mir.Inst.Index, -}) = .{}, +}) = .empty, /// Debug field, used to find bugs in the compiler. air_bookkeeping: @TypeOf(air_bookkeeping_init) = air_bookkeeping_init, diff --git a/src/codegen/sparc64/CodeGen.zig b/src/codegen/sparc64/CodeGen.zig index fa1fa97202b53442e2c87cf8f9780ea1e05a9b06..6b1e44b16ebd803e448e68799ce8d8e769ac0573 100644 --- a/src/codegen/sparc64/CodeGen.zig +++ b/src/codegen/sparc64/CodeGen.zig @@ -66,7 +66,7 @@ arg_index: usize, stack_align: Alignment, /// MIR Instructions -mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, +mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, /// MIR extra data mir_extra: std.ArrayList(u32) = .empty, @@ -1490,7 +1490,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { self.stack.deinit(self.gpa); self.stack = parent_stack; - parent_stack = .{}; + parent_stack = .empty; self.next_stack_offset = parent_next_stack_offset; self.register_manager.free_registers = parent_free_registers; diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index f3b10dc74e63b4f590bd9157b0f2ed97a84fd5bb..2e894ef2c87755c64808405863584b2c38ca7eda 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -144,7 +144,7 @@ values: ValueTable = .empty, blocks: std.array_hash_map.Auto(Air.Inst.Index, struct { label: u32, value: WValue, -}) = .{}, +}) = .empty, /// Maps `loop` instructions to their label. `br` to here repeats the loop. loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty, /// The index of the current argument. diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 5a3aa2648a58c61e59be964f0058525efa650fd9..035f40ebe214771d1a5aa669578a8da1b4a98f72 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -22,7 +22,7 @@ ptr_width: PtrWidth, /// A list of all input files. /// First index is a special "null file". Order is otherwise not observed. -files: std.MultiArrayList(File.Entry) = .{}, +files: std.MultiArrayList(File.Entry) = .empty, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. @@ -33,7 +33,7 @@ objects: std.ArrayList(File.Index) = .empty, shared_objects: std.array_hash_map.String(File.Index) = .empty, /// List of all output sections and their associated metadata. -sections: std.MultiArrayList(Section) = .{}, +sections: std.MultiArrayList(Section) = .empty, /// File offset into the shdr table. shdr_table_offset: ?u64 = null, diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 8bb2212f4af421de651ac0f7f7933aa99d5b61d4..fea4f9c452e19661d92623ea9d814a3781acadb7 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -8,7 +8,7 @@ data: std.ArrayList(u8) = .empty, basename: []const u8, index: File.Index, -symtab: std.MultiArrayList(ElfSym) = .{}, +symtab: std.MultiArrayList(ElfSym) = .empty, strtab: StringTable = .{}, symbols: std.ArrayList(Symbol) = .empty, symbols_extra: std.ArrayList(u32) = .empty, @@ -30,16 +30,16 @@ output_ar_state: Archive.ArState = .{}, dwarf: ?Dwarf = null, /// Table of tracked LazySymbols. -lazy_syms: LazySymbolTable = .{}, +lazy_syms: LazySymbolTable = .empty, /// Table of tracked `Nav`s. -navs: NavTable = .{}, +navs: NavTable = .empty, /// TLS variables indexed by Atom.Index. -tls_variables: TlsTable = .{}, +tls_variables: TlsTable = .empty, /// Table of tracked `Uav`s. -uavs: UavTable = .{}, +uavs: UavTable = .empty, debug_info_section_dirty: bool = false, debug_abbrev_section_dirty: bool = false, diff --git a/src/link/MachO.zig b/src/link/MachO.zig index eb3e6d05432ca0c7af4a86b2468041229bccf414..3f5f7951bf101c768beea37c920f216ccbd84daf 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -14,7 +14,7 @@ d_sym: ?DebugSymbols = null, /// A list of all input files. /// Index of each input file also encodes the priority or precedence of one input file /// over another. -files: std.MultiArrayList(File.Entry) = .{}, +files: std.MultiArrayList(File.Entry) = .empty, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. @@ -25,7 +25,7 @@ objects: std.ArrayList(File.Index) = .empty, dylibs: std.ArrayList(File.Index) = .empty, segments: std.ArrayList(macho.segment_command_64) = .empty, -sections: std.MultiArrayList(Section) = .{}, +sections: std.MultiArrayList(Section) = .empty, /// Populated by `allocateSections`. header_size: ?u32 = null, diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index 40d9d4e13e03714754d88f67e32f220f499bbc37..0d99db5d5103db766723006c7e4b7b0f498de76b 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -5,7 +5,7 @@ index: File.Index, file_handle: File.HandleIndex, tag: enum { dylib, tbd }, -exports: std.MultiArrayList(Export) = .{}, +exports: std.MultiArrayList(Export) = .empty, strtab: std.ArrayList(u8) = .empty, id: ?Id = null, ordinal: u16 = 0, diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig index 953627c220f9550f4bd4bd21d4301837becc97cc..6b58d685e6e2927b4f5012543c442ffbb9b3803d 100644 --- a/src/link/MachO/InternalObject.zig +++ b/src/link/MachO/InternalObject.zig @@ -1,6 +1,6 @@ index: File.Index, -sections: std.MultiArrayList(Section) = .{}, +sections: std.MultiArrayList(Section) = .empty, atoms: std.ArrayList(Atom) = .empty, atoms_indexes: std.ArrayList(Atom.Index) = .empty, atoms_extra: std.ArrayList(u32) = .empty, diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index 3c45dc419db5b1fc86b47eeffeb5c438c36ea38e..763405deff2bcefa067d7539a49ab9b2c48ee9c2 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -38,8 +38,8 @@ index: File.Index, in_archive: ?InArchive = null, header: ?macho.mach_header_64 = null, -sections: std.MultiArrayList(Section) = .{}, -symtab: std.MultiArrayList(Nlist) = .{}, +sections: std.MultiArrayList(Section) = .empty, +symtab: std.MultiArrayList(Nlist) = .empty, strtab: std.ArrayList(u8) = .empty, symbols: std.ArrayList(Symbol) = .empty, diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 017b5a1ab565b8b38c088dfecae29b4ad5f33b29..dd4acfd15ab7be86de4cb2a7bd9f86709ce4a93d 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -17,16 +17,16 @@ atoms_indexes: std.ArrayList(Atom.Index) = .empty, atoms_extra: std.ArrayList(u32) = .empty, /// Table of tracked LazySymbols. -lazy_syms: LazySymbolTable = .{}, +lazy_syms: LazySymbolTable = .empty, /// Table of tracked Navs. -navs: NavTable = .{}, +navs: NavTable = .empty, /// Table of tracked Uavs. -uavs: UavTable = .{}, +uavs: UavTable = .empty, /// TLV initializers indexed by Atom.Index. -tlv_initializers: TlvInitializerTable = .{}, +tlv_initializers: TlvInitializerTable = .empty, /// A table of relocations. relocs: RelocationTable = .empty, diff --git a/src/link/MachO/dyld_info/Trie.zig b/src/link/MachO/dyld_info/Trie.zig index 92c22967f3e23647d84b399ffdc6ac92a60f2f8e..cb1261681b62b63f324df173184acdaa625a1f72 100644 --- a/src/link/MachO/dyld_info/Trie.zig +++ b/src/link/MachO/dyld_info/Trie.zig @@ -32,7 +32,7 @@ /// The root node of the trie. root: ?Node.Index = null, buffer: std.ArrayList(u8) = .empty, -nodes: std.MultiArrayList(Node) = .{}, +nodes: std.MultiArrayList(Node) = .empty, edges: std.ArrayList(Edge) = .empty, /// Insert a symbol into the trie, updating the prefixes in the process. diff --git a/src/link/Spork8.zig b/src/link/Spork8.zig index 6f925fbc71fb092a11c4fa3b8d99c0e406c6e436..d36922e9257a4981e1c287b12a668c60fbca1e79 100644 --- a/src/link/Spork8.zig +++ b/src/link/Spork8.zig @@ -22,7 +22,7 @@ const Value = @import("../Value.zig"); base: link.File, /// All MIR instructions for all Zcu functions. -mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, +mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, /// Corresponds to `mir_instructions`. mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// When the key is an enum type, this represents a `@tagName` function. -- 2.54.0