authorgravatar for rb.lymn@gmail.comRobbie Lyman <rb.lymn@gmail.com> 2026-08-28 20:15:22-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-09 23:13:33+02:00
logd69634c10d2e4ca4af834a0644136ac1af72cd26
tree42aaaecbdaef93ad754ceeb1a0eb97f11681d1f7
parentf2084ab74a8279db4a4607d97d49d27b0acda4db

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.

24 files changed, 67 insertions(+), 67 deletions(-)

lib/compiler/Maker/Watch.zig+10-10
...@@ -110,12 +110,12 @@ const Os = switch (builtin.os.tag) {...@@ -110,12 +110,12 @@ const Os = switch (builtin.os.tag) {
110110
111 fn init(maker: *Maker) !Watch {111 fn init(maker: *Maker) !Watch {
112 return .{112 return .{
113 .dir_table = .{},113 .dir_table = .empty,
114 .dir_count = 0,114 .dir_count = 0,
115 .os = switch (builtin.os.tag) {115 .os = switch (builtin.os.tag) {
116 .linux => .{116 .linux => .{
117 .handle_table = .{},117 .handle_table = .empty,
118 .poll_fds = .{},118 .poll_fds = .empty,
119 },119 },
120 else => {},120 else => {},
121 },121 },
...@@ -248,7 +248,7 @@ const Os = switch (builtin.os.tag) {...@@ -248,7 +248,7 @@ const Os = switch (builtin.os.tag) {
248 _ = w.dir_table.pop();248 _ = w.dir_table.pop();
249 } else {249 } else {
250 assert(dh_gop.index == gop.index);250 assert(dh_gop.index == gop.index);
251 dh_gop.value_ptr.* = .{ .mount_id = mount_id, .reaction_set = .{} };251 dh_gop.value_ptr.* = .{ .mount_id = mount_id, .reaction_set = .empty };
252 posix.fanotify_mark(fan_fd, .{252 posix.fanotify_mark(fan_fd, .{
253 .ADD = true,253 .ADD = true,
254 .ONLYDIR = true,254 .ONLYDIR = true,
...@@ -261,7 +261,7 @@ const Os = switch (builtin.os.tag) {...@@ -261,7 +261,7 @@ const Os = switch (builtin.os.tag) {
261 };261 };
262 for (files.items) |basename| {262 for (files.items) |basename| {
263 const gop = try reaction_set.getOrPut(gpa, basename);263 const gop = try reaction_set.getOrPut(gpa, basename);
264 if (!gop.found_existing) gop.value_ptr.* = .{};264 if (!gop.found_existing) gop.value_ptr.* = .empty;
265 try gop.value_ptr.put(gpa, step_index, w.generation);265 try gop.value_ptr.put(gpa, step_index, w.generation);
266 }266 }
267 }267 }
...@@ -488,7 +488,7 @@ const Os = switch (builtin.os.tag) {...@@ -488,7 +488,7 @@ const Os = switch (builtin.os.tag) {
488488
489 fn init(maker: *Maker) !Watch {489 fn init(maker: *Maker) !Watch {
490 return .{490 return .{
491 .dir_table = .{},491 .dir_table = .empty,
492 .dir_count = 0,492 .dir_count = 0,
493 .os = switch (builtin.os.tag) {493 .os = switch (builtin.os.tag) {
494 .windows => .{494 .windows => .{
...@@ -610,7 +610,7 @@ const Os = switch (builtin.os.tag) {...@@ -610,7 +610,7 @@ const Os = switch (builtin.os.tag) {
610 };610 };
611 for (files.items) |basename| {611 for (files.items) |basename| {
612 const gop = try dir.reaction_set.getOrPut(gpa, basename);612 const gop = try dir.reaction_set.getOrPut(gpa, basename);
613 if (!gop.found_existing) gop.value_ptr.* = .{};613 if (!gop.found_existing) gop.value_ptr.* = .empty;
614 try gop.value_ptr.put(gpa, step_index, w.generation);614 try gop.value_ptr.put(gpa, step_index, w.generation);
615 }615 }
616 }616 }
...@@ -713,7 +713,7 @@ const Os = switch (builtin.os.tag) {...@@ -713,7 +713,7 @@ const Os = switch (builtin.os.tag) {
713713
714 fn init(maker: *Maker) !Watch {714 fn init(maker: *Maker) !Watch {
715 return .{715 return .{
716 .dir_table = .{},716 .dir_table = .empty,
717 .dir_count = 0,717 .dir_count = 0,
718 .os = .{718 .os = .{
719 .kq_fd = try Io.Kqueue.createFileDescriptor(),719 .kq_fd = try Io.Kqueue.createFileDescriptor(),
...@@ -769,7 +769,7 @@ const Os = switch (builtin.os.tag) {...@@ -769,7 +769,7 @@ const Os = switch (builtin.os.tag) {
769 _ = try Io.Kqueue.kevent(w.os.kq_fd, &changes, &.{}, null);769 _ = try Io.Kqueue.kevent(w.os.kq_fd, &changes, &.{}, null);
770 assert(handles.len == gop.index);770 assert(handles.len == gop.index);
771 try handles.append(gpa, .{771 try handles.append(gpa, .{
772 .rs = .{},772 .rs = .empty,
773 .dir_fd = if (skip_open_dir) -1 else dir_fd,773 .dir_fd = if (skip_open_dir) -1 else dir_fd,
774 });774 });
775 }775 }
...@@ -778,7 +778,7 @@ const Os = switch (builtin.os.tag) {...@@ -778,7 +778,7 @@ const Os = switch (builtin.os.tag) {
778 };778 };
779 for (files.items) |basename| {779 for (files.items) |basename| {
780 const gop = try reaction_set.getOrPut(gpa, basename);780 const gop = try reaction_set.getOrPut(gpa, basename);
781 if (!gop.found_existing) gop.value_ptr.* = .{};781 if (!gop.found_existing) gop.value_ptr.* = .empty;
782 try gop.value_ptr.put(gpa, step_index, w.generation);782 try gop.value_ptr.put(gpa, step_index, w.generation);
783 }783 }
784 }784 }
lib/compiler/aro/aro/CodeGen.zig+1-1
...@@ -17,7 +17,7 @@ const QualType = @import("TypeStore.zig").QualType;...@@ -17,7 +17,7 @@ const QualType = @import("TypeStore.zig").QualType;
17const Value = @import("Value.zig");17const Value = @import("Value.zig");
1818
19const WipSwitch = struct {19const WipSwitch = struct {
20 cases: Cases = .{},20 cases: Cases = .empty,
21 default: ?Ir.Ref = null,21 default: ?Ir.Ref = null,
22 size: u64,22 size: u64,
2323
lib/compiler/aro/aro/Hideset.zig+3-3
...@@ -41,11 +41,11 @@ pub const Index = enum(u32) {...@@ -41,11 +41,11 @@ pub const Index = enum(u32) {
41 _,41 _,
42};42};
4343
44map: std.AutoHashMapUnmanaged(Identifier, Index) = .{},44map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty,
45/// Used for computing union/intersection of two lists; stored here so that allocations can be retained45/// Used for computing union/intersection of two lists; stored here so that allocations can be retained
46/// until hideset is deinit'ed46/// until hideset is deinit'ed
47tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{},47tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty,
48linked_list: Item.List = .{},48linked_list: Item.List = .empty,
49comp: *const Compilation,49comp: *const Compilation,
5050
51/// Invalidated if the underlying MultiArrayList slice is reallocated due to resize51/// Invalidated if the underlying MultiArrayList slice is reallocated due to resize
lib/compiler/aro/backend/Ir.zig+1-1
...@@ -179,7 +179,7 @@ pub const Renderer = struct {...@@ -179,7 +179,7 @@ pub const Renderer = struct {
179 gpa: Allocator,179 gpa: Allocator,
180 obj: *Object,180 obj: *Object,
181 ir: *const Ir,181 ir: *const Ir,
182 errors: ErrorList = .{},182 errors: ErrorList = .empty,
183183
184 pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8);184 pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8);
185185
lib/std/array_hash_map.zig+4-4
...@@ -87,7 +87,7 @@ pub fn Custom(...@@ -87,7 +87,7 @@ pub fn Custom(
87 return struct {87 return struct {
88 /// It is permitted to access this field directly.88 /// It is permitted to access this field directly.
89 /// After any modification to the keys, consider calling `reIndex`.89 /// After any modification to the keys, consider calling `reIndex`.
90 entries: DataList = .{},90 entries: DataList = .empty,
9191
92 /// When entries length is less than `linear_scan_max`, this remains `null`.92 /// When entries length is less than `linear_scan_max`, this remains `null`.
93 /// Once entries length grows big enough, this field is allocated. There is93 /// Once entries length grows big enough, this field is allocated. There is
...@@ -100,7 +100,7 @@ pub fn Custom(...@@ -100,7 +100,7 @@ pub fn Custom(
100100
101 /// A map containing no keys or values.101 /// A map containing no keys or values.
102 pub const empty: Self = .{102 pub const empty: Self = .{
103 .entries = .{},103 .entries = .empty,
104 .index_header = null,104 .index_header = null,
105 };105 };
106106
...@@ -165,7 +165,7 @@ pub fn Custom(...@@ -165,7 +165,7 @@ pub fn Custom(
165 const Oom = Allocator.Error;165 const Oom = Allocator.Error;
166166
167 pub fn init(gpa: Allocator, key_list: []const K, value_list: []const V) Oom!Self {167 pub fn init(gpa: Allocator, key_list: []const K, value_list: []const V) Oom!Self {
168 var self: Self = .{};168 var self: Self = .empty;
169 errdefer self.deinit(gpa);169 errdefer self.deinit(gpa);
170 try self.reinit(gpa, key_list, value_list);170 try self.reinit(gpa, key_list, value_list);
171 return self;171 return self;
...@@ -836,7 +836,7 @@ pub fn Custom(...@@ -836,7 +836,7 @@ pub fn Custom(
836 return self.cloneContext(gpa, undefined);836 return self.cloneContext(gpa, undefined);
837 }837 }
838 pub fn cloneContext(self: Self, gpa: Allocator, ctx: Context) Oom!Self {838 pub fn cloneContext(self: Self, gpa: Allocator, ctx: Context) Oom!Self {
839 var other: Self = .{};839 var other: Self = .empty;
840 other.entries = try self.entries.clone(gpa);840 other.entries = try self.entries.clone(gpa);
841 errdefer other.entries.deinit(gpa);841 errdefer other.entries.deinit(gpa);
842842
lib/std/multi_array_list.zig+2-2
...@@ -227,7 +227,7 @@ pub fn MultiArrayList(comptime T: type) type {...@@ -227,7 +227,7 @@ pub fn MultiArrayList(comptime T: type) type {
227 /// The caller owns the returned memory. Empties this MultiArrayList.227 /// The caller owns the returned memory. Empties this MultiArrayList.
228 pub fn toOwnedSlice(self: *Self) Slice {228 pub fn toOwnedSlice(self: *Self) Slice {
229 const result = self.slice();229 const result = self.slice();
230 self.* = .{};230 self.* = .empty;
231 return result;231 return result;
232 }232 }
233233
...@@ -496,7 +496,7 @@ pub fn MultiArrayList(comptime T: type) type {...@@ -496,7 +496,7 @@ pub fn MultiArrayList(comptime T: type) type {
496496
497 pub fn clearAndFree(self: *Self, gpa: Allocator) void {497 pub fn clearAndFree(self: *Self, gpa: Allocator) void {
498 gpa.free(self.allocatedBytes());498 gpa.free(self.allocatedBytes());
499 self.* = .{};499 self.* = .empty;
500 }500 }
501501
502 /// Reduce length to `new_len`.502 /// Reduce length to `new_len`.
lib/std/zig/AstGen.zig+1-1
...@@ -21,7 +21,7 @@ tree: *const Ast,...@@ -21,7 +21,7 @@ tree: *const Ast,
21/// The set of nodes which, given the choice, must expose a result pointer to21/// The set of nodes which, given the choice, must expose a result pointer to
22/// sub-expressions. See `AstRlAnnotate` for details.22/// sub-expressions. See `AstRlAnnotate` for details.
23nodes_need_rl: *const AstRlAnnotate.RlNeededSet,23nodes_need_rl: *const AstRlAnnotate.RlNeededSet,
24instructions: std.MultiArrayList(Zir.Inst) = .{},24instructions: std.MultiArrayList(Zir.Inst) = .empty,
25extra: ArrayList(u32) = .empty,25extra: ArrayList(u32) = .empty,
26string_bytes: ArrayList(u8) = .empty,26string_bytes: ArrayList(u8) = .empty,
27/// Tracks the current byte offset within the source file.27/// Tracks the current byte offset within the source file.
lib/std/zig/llvm/Builder.zig+2-2
...@@ -1429,7 +1429,7 @@ pub const Type = enum(u32) {...@@ -1429,7 +1429,7 @@ pub const Type = enum(u32) {
1429 }1429 }
14301430
1431 pub fn isSized(self: Type, builder: *const Builder) Allocator.Error!bool {1431 pub fn isSized(self: Type, builder: *const Builder) Allocator.Error!bool {
1432 var visited: IsSizedVisited = .{};1432 var visited: IsSizedVisited = .empty;
1433 defer visited.deinit(builder.gpa);1433 defer visited.deinit(builder.gpa);
1434 const result = try self.isSizedVisited(&visited, builder);1434 const result = try self.isSizedVisited(&visited, builder);
1435 return result;1435 return result;
...@@ -14710,7 +14710,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco...@@ -14710,7 +14710,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco
14710 var attributes_set: std.array_hash_map.Auto(struct {14710 var attributes_set: std.array_hash_map.Auto(struct {
14711 attributes: Attributes,14711 attributes: Attributes,
14712 index: u32,14712 index: u32,
14713 }, void) = .{};14713 }, void) = .empty;
14714 defer attributes_set.deinit(self.gpa);14714 defer attributes_set.deinit(self.gpa);
1471514715
14716 // PARAMATTR_GROUP_BLOCK14716 // PARAMATTR_GROUP_BLOCK
src/Sema.zig+10-10
...@@ -44,7 +44,7 @@ gpa: Allocator,...@@ -44,7 +44,7 @@ gpa: Allocator,
44/// This arena will be cleared when the sema is destroyed.44/// This arena will be cleared when the sema is destroyed.
45arena: Allocator,45arena: Allocator,
46code: Zir,46code: Zir,
47air_instructions: std.MultiArrayList(Air.Inst) = .{},47air_instructions: std.MultiArrayList(Air.Inst) = .empty,
48air_extra: std.ArrayList(u32) = .empty,48air_extra: std.ArrayList(u32) = .empty,
49/// Maps ZIR to AIR.49/// Maps ZIR to AIR.
50inst_map: InstMap = .{},50inst_map: InstMap = .{},
...@@ -161,7 +161,7 @@ const MaybeComptimeAlloc = struct {...@@ -161,7 +161,7 @@ const MaybeComptimeAlloc = struct {
161 stores: std.MultiArrayList(struct {161 stores: std.MultiArrayList(struct {
162 inst: Air.Inst.Index,162 inst: Air.Inst.Index,
163 src: LazySrcLoc,163 src: LazySrcLoc,
164 }) = .{},164 }) = .empty,
165};165};
166166
167const ComptimeAlloc = struct {167const ComptimeAlloc = struct {
...@@ -214,7 +214,7 @@ pub const InferredErrorSet = struct {...@@ -214,7 +214,7 @@ pub const InferredErrorSet = struct {
214 /// All currently known errors that this error set contains. This includes214 /// All currently known errors that this error set contains. This includes
215 /// direct additions via `return error.Foo;`, and possibly also errors that215 /// direct additions via `return error.Foo;`, and possibly also errors that
216 /// are returned from any dependent functions.216 /// are returned from any dependent functions.
217 errors: NameMap = .{},217 errors: NameMap = .empty,
218 /// Other inferred error sets which this inferred error set should include.218 /// Other inferred error sets which this inferred error set should include.
219 inferred_error_sets: std.array_hash_map.Auto(InternPool.Index, void) = .empty,219 inferred_error_sets: std.array_hash_map.Auto(InternPool.Index, void) = .empty,
220 /// The regular error set created by resolving this inferred error set.220 /// The regular error set created by resolving this inferred error set.
...@@ -363,7 +363,7 @@ pub const Block = struct {...@@ -363,7 +363,7 @@ pub const Block = struct {
363 /// function type.363 /// function type.
364 /// This memory is allocated by a parent `Sema` in the temporary arena, and is364 /// This memory is allocated by a parent `Sema` in the temporary arena, and is
365 /// used to add a `func_instance` into the `InternPool`.365 /// used to add a `func_instance` into the `InternPool`.
366 params: std.MultiArrayList(Param) = .{},366 params: std.MultiArrayList(Param) = .empty,
367367
368 label: ?*Label = null,368 label: ?*Label = null,
369 inlining: ?*Inlining,369 inlining: ?*Inlining,
...@@ -3038,7 +3038,7 @@ fn zirErrorSetDecl(...@@ -3038,7 +3038,7 @@ fn zirErrorSetDecl(
3038 const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node;3038 const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node;
3039 const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index);3039 const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index);
30403040
3041 var names: InferredErrorSet.NameMap = .{};3041 var names: InferredErrorSet.NameMap = .empty;
3042 try names.ensureUnusedCapacity(sema.arena, extra.data.fields_len);3042 try names.ensureUnusedCapacity(sema.arena, extra.data.fields_len);
30433043
3044 var extra_index: u32 = @intCast(extra.end);3044 var extra_index: u32 = @intCast(extra.end);
...@@ -8440,7 +8440,7 @@ fn resolveGenericBody(...@@ -8440,7 +8440,7 @@ fn resolveGenericBody(
84408440
8441 // Make sure any nested param instructions don't clobber our work.8441 // Make sure any nested param instructions don't clobber our work.
8442 const prev_params = block.params;8442 const prev_params = block.params;
8443 block.params = .{};8443 block.params = .empty;
8444 defer {8444 defer {
8445 block.params = prev_params;8445 block.params = prev_params;
8446 }8446 }
...@@ -9108,7 +9108,7 @@ fn zirParam(...@@ -9108,7 +9108,7 @@ fn zirParam(
9108 const param_ty: Type = if (extra.data.type.is_generic) .generic_poison else ty: {9108 const param_ty: Type = if (extra.data.type.is_generic) .generic_poison else ty: {
9109 // Make sure any nested param instructions don't clobber our work.9109 // Make sure any nested param instructions don't clobber our work.
9110 const prev_params = block.params;9110 const prev_params = block.params;
9111 block.params = .{};9111 block.params = .empty;
9112 defer {9112 defer {
9113 block.params = prev_params;9113 block.params = prev_params;
9114 }9114 }
...@@ -11542,7 +11542,7 @@ fn validateSwitchBlock(...@@ -11542,7 +11542,7 @@ fn validateSwitchBlock(
11542 );11542 );
11543 }11543 }
1154411544
11545 var names: InferredErrorSet.NameMap = .{};11545 var names: InferredErrorSet.NameMap = .empty;
11546 try names.ensureUnusedCapacity(sema.arena, error_names.len);11546 try names.ensureUnusedCapacity(sema.arena, error_names.len);
11547 for (error_names.get(ip)) |error_name| {11547 for (error_names.get(ip)) |error_name| {
11548 if (seen.errors.contains(error_name)) continue;11548 if (seen.errors.contains(error_name)) continue;
...@@ -12177,7 +12177,7 @@ fn analyzeSwitchCaptures(...@@ -12177,7 +12177,7 @@ fn analyzeSwitchCaptures(
12177 break :payload_ref try sema.errorCastUnchecked(case_block, capture_err_ty, loaded_operand);12177 break :payload_ref try sema.errorCastUnchecked(case_block, capture_err_ty, loaded_operand);
12178 },12178 },
12179 .item_refs => |item_refs| {12179 .item_refs => |item_refs| {
12180 var names: InferredErrorSet.NameMap = .{};12180 var names: InferredErrorSet.NameMap = .empty;
12181 try names.ensureUnusedCapacity(sema.arena, item_refs.len);12181 try names.ensureUnusedCapacity(sema.arena, item_refs.len);
12182 for (item_refs) |item_ref| {12182 for (item_refs) |item_ref| {
12183 const item_val = sema.resolveValue(item_ref).?;12183 const item_val = sema.resolveValue(item_ref).?;
...@@ -34511,7 +34511,7 @@ fn errorSetMerge(sema: *Sema, lhs: Type, rhs: Type) !Type {...@@ -34511,7 +34511,7 @@ fn errorSetMerge(sema: *Sema, lhs: Type, rhs: Type) !Type {
34511 const arena = sema.arena;34511 const arena = sema.arena;
34512 const lhs_names = lhs.errorSetNames(pt.zcu);34512 const lhs_names = lhs.errorSetNames(pt.zcu);
34513 const rhs_names = rhs.errorSetNames(pt.zcu);34513 const rhs_names = rhs.errorSetNames(pt.zcu);
34514 var names: InferredErrorSet.NameMap = .{};34514 var names: InferredErrorSet.NameMap = .empty;
34515 try names.ensureUnusedCapacity(arena, lhs_names.len);34515 try names.ensureUnusedCapacity(arena, lhs_names.len);
3451634516
34517 for (0..lhs_names.len) |lhs_index| {34517 for (0..lhs_names.len) |lhs_index| {
src/Zcu.zig+2-2
...@@ -102,7 +102,7 @@ single_exports: std.array_hash_map.Auto(AnalUnit, Export.Index) = .empty,...@@ -102,7 +102,7 @@ single_exports: std.array_hash_map.Auto(AnalUnit, Export.Index) = .empty,
102multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct {102multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct {
103 index: u32,103 index: u32,
104 len: u32,104 len: u32,
105}) = .{},105}) = .empty,
106106
107/// Key is the digest returned by `Builtin.hash`; value is the corresponding module.107/// Key is the digest returned by `Builtin.hash`; value is the corresponding module.
108builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Module) = .empty,108builtin_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 {...@@ -3050,7 +3050,7 @@ pub fn loadZirCache(gpa: Allocator, io: Io, cache_file: Io.File) !Zir {
3050}3050}
30513051
3052pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader) !Zir {3052pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader) !Zir {
3053 var instructions: std.MultiArrayList(Zir.Inst) = .{};3053 var instructions: std.MultiArrayList(Zir.Inst) = .empty;
3054 errdefer instructions.deinit(gpa);3054 errdefer instructions.deinit(gpa);
30553055
3056 try instructions.setCapacity(gpa, header.instructions_len);3056 try instructions.setCapacity(gpa, header.instructions_len);
src/Zcu/PerThread.zig+2-2
...@@ -817,7 +817,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {...@@ -817,7 +817,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {
817 try updated_files.putNoClobber(gpa, file_index, .{817 try updated_files.putNoClobber(gpa, file_index, .{
818 .file = file,818 .file = file,
819 // We intentionally don't map any instructions here; that's the point, the whole file is outdated!819 // We intentionally don't map any instructions here; that's the point, the whole file is outdated!
820 .inst_map = .{},820 .inst_map = .empty,
821 });821 });
822 continue;822 continue;
823 }823 }
...@@ -837,7 +837,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {...@@ -837,7 +837,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {
837 assert(!gop.found_existing);837 assert(!gop.found_existing);
838 gop.value_ptr.* = .{838 gop.value_ptr.* = .{
839 .file = file,839 .file = file,
840 .inst_map = .{},840 .inst_map = .empty,
841 };841 };
842 try Zcu.mapOldZirToNew(gpa, old_zir, new_zir, &gop.value_ptr.inst_map);842 try Zcu.mapOldZirToNew(gpa, old_zir, new_zir, &gop.value_ptr.inst_map);
843 }843 }
src/codegen/llvm/FuncGen.zig+1-1
...@@ -1360,7 +1360,7 @@ fn lowerBlock(...@@ -1360,7 +1360,7 @@ fn lowerBlock(
13601360
1361 const have_block_result = inst_ty.hasRuntimeBits(zcu);1361 const have_block_result = inst_ty.hasRuntimeBits(zcu);
13621362
1363 var breaks: BreakList = if (have_block_result) .{ .list = .{} } else .{ .len = 0 };1363 var breaks: BreakList = if (have_block_result) .{ .list = .empty } else .{ .len = 0 };
1364 defer if (have_block_result) breaks.list.deinit(self.gpa);1364 defer if (have_block_result) breaks.list.deinit(self.gpa);
13651365
1366 const parent_bb = try self.wip.block(0, "Block");1366 const parent_bb = try self.wip.block(0, "Block");
src/codegen/riscv64/CodeGen.zig+6-6
...@@ -78,7 +78,7 @@ func_index: InternPool.Index,...@@ -78,7 +78,7 @@ func_index: InternPool.Index,
78fn_type: Type,78fn_type: Type,
79arg_index: usize,79arg_index: usize,
8080
81mir_instructions: std.MultiArrayList(Mir.Inst) = .{},81mir_instructions: std.MultiArrayList(Mir.Inst) = .empty,
8282
83owner: Owner,83owner: Owner,
8484
...@@ -112,19 +112,19 @@ vtype: ?bits.VType,...@@ -112,19 +112,19 @@ vtype: ?bits.VType,
112blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,112blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
113register_manager: RegisterManager = .{},113register_manager: RegisterManager = .{},
114114
115const_tracking: ConstTrackingMap = .{},115const_tracking: ConstTrackingMap = .empty,
116inst_tracking: InstTrackingMap = .{},116inst_tracking: InstTrackingMap = .empty,
117117
118frame_allocs: std.MultiArrayList(FrameAlloc) = .{},118frame_allocs: std.MultiArrayList(FrameAlloc) = .empty,
119free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty,119free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty,
120frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},120frame_locs: std.MultiArrayList(Mir.FrameLoc) = .empty,
121121
122loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {122loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {
123 /// The state to restore before branching.123 /// The state to restore before branching.
124 state: State,124 state: State,
125 /// The branch target.125 /// The branch target.
126 jmp_target: Mir.Inst.Index,126 jmp_target: Mir.Inst.Index,
127}) = .{},127}) = .empty,
128128
129/// Debug field, used to find bugs in the compiler.129/// Debug field, used to find bugs in the compiler.
130air_bookkeeping: @TypeOf(air_bookkeeping_init) = air_bookkeeping_init,130air_bookkeeping: @TypeOf(air_bookkeeping_init) = air_bookkeeping_init,
src/codegen/sparc64/CodeGen.zig+2-2
...@@ -66,7 +66,7 @@ arg_index: usize,...@@ -66,7 +66,7 @@ arg_index: usize,
66stack_align: Alignment,66stack_align: Alignment,
6767
68/// MIR Instructions68/// MIR Instructions
69mir_instructions: std.MultiArrayList(Mir.Inst) = .{},69mir_instructions: std.MultiArrayList(Mir.Inst) = .empty,
70/// MIR extra data70/// MIR extra data
71mir_extra: std.ArrayList(u32) = .empty,71mir_extra: std.ArrayList(u32) = .empty,
7272
...@@ -1490,7 +1490,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {...@@ -1490,7 +1490,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
14901490
1491 self.stack.deinit(self.gpa);1491 self.stack.deinit(self.gpa);
1492 self.stack = parent_stack;1492 self.stack = parent_stack;
1493 parent_stack = .{};1493 parent_stack = .empty;
14941494
1495 self.next_stack_offset = parent_next_stack_offset;1495 self.next_stack_offset = parent_next_stack_offset;
1496 self.register_manager.free_registers = parent_free_registers;1496 self.register_manager.free_registers = parent_free_registers;
src/codegen/wasm/CodeGen.zig+1-1
...@@ -144,7 +144,7 @@ values: ValueTable = .empty,...@@ -144,7 +144,7 @@ values: ValueTable = .empty,
144blocks: std.array_hash_map.Auto(Air.Inst.Index, struct {144blocks: std.array_hash_map.Auto(Air.Inst.Index, struct {
145 label: u32,145 label: u32,
146 value: WValue,146 value: WValue,
147}) = .{},147}) = .empty,
148/// Maps `loop` instructions to their label. `br` to here repeats the loop.148/// Maps `loop` instructions to their label. `br` to here repeats the loop.
149loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty,149loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty,
150/// The index of the current argument.150/// The index of the current argument.
src/link/Elf.zig+2-2
...@@ -22,7 +22,7 @@ ptr_width: PtrWidth,...@@ -22,7 +22,7 @@ ptr_width: PtrWidth,
2222
23/// A list of all input files.23/// A list of all input files.
24/// First index is a special "null file". Order is otherwise not observed.24/// First index is a special "null file". Order is otherwise not observed.
25files: std.MultiArrayList(File.Entry) = .{},25files: std.MultiArrayList(File.Entry) = .empty,
26/// Long-lived list of all file descriptors.26/// Long-lived list of all file descriptors.
27/// We store them globally rather than per actual File so that we can re-use27/// We store them globally rather than per actual File so that we can re-use
28/// one file handle per every object file within an archive.28/// one file handle per every object file within an archive.
...@@ -33,7 +33,7 @@ objects: std.ArrayList(File.Index) = .empty,...@@ -33,7 +33,7 @@ objects: std.ArrayList(File.Index) = .empty,
33shared_objects: std.array_hash_map.String(File.Index) = .empty,33shared_objects: std.array_hash_map.String(File.Index) = .empty,
3434
35/// List of all output sections and their associated metadata.35/// List of all output sections and their associated metadata.
36sections: std.MultiArrayList(Section) = .{},36sections: std.MultiArrayList(Section) = .empty,
37/// File offset into the shdr table.37/// File offset into the shdr table.
38shdr_table_offset: ?u64 = null,38shdr_table_offset: ?u64 = null,
3939
src/link/Elf/ZigObject.zig+5-5
...@@ -8,7 +8,7 @@ data: std.ArrayList(u8) = .empty,...@@ -8,7 +8,7 @@ data: std.ArrayList(u8) = .empty,
8basename: []const u8,8basename: []const u8,
9index: File.Index,9index: File.Index,
1010
11symtab: std.MultiArrayList(ElfSym) = .{},11symtab: std.MultiArrayList(ElfSym) = .empty,
12strtab: StringTable = .{},12strtab: StringTable = .{},
13symbols: std.ArrayList(Symbol) = .empty,13symbols: std.ArrayList(Symbol) = .empty,
14symbols_extra: std.ArrayList(u32) = .empty,14symbols_extra: std.ArrayList(u32) = .empty,
...@@ -30,16 +30,16 @@ output_ar_state: Archive.ArState = .{},...@@ -30,16 +30,16 @@ output_ar_state: Archive.ArState = .{},
30dwarf: ?Dwarf = null,30dwarf: ?Dwarf = null,
3131
32/// Table of tracked LazySymbols.32/// Table of tracked LazySymbols.
33lazy_syms: LazySymbolTable = .{},33lazy_syms: LazySymbolTable = .empty,
3434
35/// Table of tracked `Nav`s.35/// Table of tracked `Nav`s.
36navs: NavTable = .{},36navs: NavTable = .empty,
3737
38/// TLS variables indexed by Atom.Index.38/// TLS variables indexed by Atom.Index.
39tls_variables: TlsTable = .{},39tls_variables: TlsTable = .empty,
4040
41/// Table of tracked `Uav`s.41/// Table of tracked `Uav`s.
42uavs: UavTable = .{},42uavs: UavTable = .empty,
4343
44debug_info_section_dirty: bool = false,44debug_info_section_dirty: bool = false,
45debug_abbrev_section_dirty: bool = false,45debug_abbrev_section_dirty: bool = false,
src/link/MachO.zig+2-2
...@@ -14,7 +14,7 @@ d_sym: ?DebugSymbols = null,...@@ -14,7 +14,7 @@ d_sym: ?DebugSymbols = null,
14/// A list of all input files.14/// A list of all input files.
15/// Index of each input file also encodes the priority or precedence of one input file15/// Index of each input file also encodes the priority or precedence of one input file
16/// over another.16/// over another.
17files: std.MultiArrayList(File.Entry) = .{},17files: std.MultiArrayList(File.Entry) = .empty,
18/// Long-lived list of all file descriptors.18/// Long-lived list of all file descriptors.
19/// We store them globally rather than per actual File so that we can re-use19/// We store them globally rather than per actual File so that we can re-use
20/// one file handle per every object file within an archive.20/// one file handle per every object file within an archive.
...@@ -25,7 +25,7 @@ objects: std.ArrayList(File.Index) = .empty,...@@ -25,7 +25,7 @@ objects: std.ArrayList(File.Index) = .empty,
25dylibs: std.ArrayList(File.Index) = .empty,25dylibs: std.ArrayList(File.Index) = .empty,
2626
27segments: std.ArrayList(macho.segment_command_64) = .empty,27segments: std.ArrayList(macho.segment_command_64) = .empty,
28sections: std.MultiArrayList(Section) = .{},28sections: std.MultiArrayList(Section) = .empty,
29/// Populated by `allocateSections`.29/// Populated by `allocateSections`.
30header_size: ?u32 = null,30header_size: ?u32 = null,
3131
src/link/MachO/Dylib.zig+1-1
...@@ -5,7 +5,7 @@ index: File.Index,...@@ -5,7 +5,7 @@ index: File.Index,
5file_handle: File.HandleIndex,5file_handle: File.HandleIndex,
6tag: enum { dylib, tbd },6tag: enum { dylib, tbd },
77
8exports: std.MultiArrayList(Export) = .{},8exports: std.MultiArrayList(Export) = .empty,
9strtab: std.ArrayList(u8) = .empty,9strtab: std.ArrayList(u8) = .empty,
10id: ?Id = null,10id: ?Id = null,
11ordinal: u16 = 0,11ordinal: u16 = 0,
src/link/MachO/InternalObject.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1index: File.Index,1index: File.Index,
22
3sections: std.MultiArrayList(Section) = .{},3sections: std.MultiArrayList(Section) = .empty,
4atoms: std.ArrayList(Atom) = .empty,4atoms: std.ArrayList(Atom) = .empty,
5atoms_indexes: std.ArrayList(Atom.Index) = .empty,5atoms_indexes: std.ArrayList(Atom.Index) = .empty,
6atoms_extra: std.ArrayList(u32) = .empty,6atoms_extra: std.ArrayList(u32) = .empty,
src/link/MachO/Object.zig+2-2
...@@ -38,8 +38,8 @@ index: File.Index,...@@ -38,8 +38,8 @@ index: File.Index,
38in_archive: ?InArchive = null,38in_archive: ?InArchive = null,
3939
40header: ?macho.mach_header_64 = null,40header: ?macho.mach_header_64 = null,
41sections: std.MultiArrayList(Section) = .{},41sections: std.MultiArrayList(Section) = .empty,
42symtab: std.MultiArrayList(Nlist) = .{},42symtab: std.MultiArrayList(Nlist) = .empty,
43strtab: std.ArrayList(u8) = .empty,43strtab: std.ArrayList(u8) = .empty,
4444
45symbols: std.ArrayList(Symbol) = .empty,45symbols: std.ArrayList(Symbol) = .empty,
src/link/MachO/ZigObject.zig+4-4
...@@ -17,16 +17,16 @@ atoms_indexes: std.ArrayList(Atom.Index) = .empty,...@@ -17,16 +17,16 @@ atoms_indexes: std.ArrayList(Atom.Index) = .empty,
17atoms_extra: std.ArrayList(u32) = .empty,17atoms_extra: std.ArrayList(u32) = .empty,
1818
19/// Table of tracked LazySymbols.19/// Table of tracked LazySymbols.
20lazy_syms: LazySymbolTable = .{},20lazy_syms: LazySymbolTable = .empty,
2121
22/// Table of tracked Navs.22/// Table of tracked Navs.
23navs: NavTable = .{},23navs: NavTable = .empty,
2424
25/// Table of tracked Uavs.25/// Table of tracked Uavs.
26uavs: UavTable = .{},26uavs: UavTable = .empty,
2727
28/// TLV initializers indexed by Atom.Index.28/// TLV initializers indexed by Atom.Index.
29tlv_initializers: TlvInitializerTable = .{},29tlv_initializers: TlvInitializerTable = .empty,
3030
31/// A table of relocations.31/// A table of relocations.
32relocs: RelocationTable = .empty,32relocs: RelocationTable = .empty,
src/link/MachO/dyld_info/Trie.zig+1-1
...@@ -32,7 +32,7 @@...@@ -32,7 +32,7 @@
32/// The root node of the trie.32/// The root node of the trie.
33root: ?Node.Index = null,33root: ?Node.Index = null,
34buffer: std.ArrayList(u8) = .empty,34buffer: std.ArrayList(u8) = .empty,
35nodes: std.MultiArrayList(Node) = .{},35nodes: std.MultiArrayList(Node) = .empty,
36edges: std.ArrayList(Edge) = .empty,36edges: std.ArrayList(Edge) = .empty,
3737
38/// Insert a symbol into the trie, updating the prefixes in the process.38/// Insert a symbol into the trie, updating the prefixes in the process.
src/link/Spork8.zig+1-1
...@@ -22,7 +22,7 @@ const Value = @import("../Value.zig");...@@ -22,7 +22,7 @@ const Value = @import("../Value.zig");
2222
23base: link.File,23base: link.File,
24/// All MIR instructions for all Zcu functions.24/// All MIR instructions for all Zcu functions.
25mir_instructions: std.MultiArrayList(Mir.Inst) = .{},25mir_instructions: std.MultiArrayList(Mir.Inst) = .empty,
26/// Corresponds to `mir_instructions`.26/// Corresponds to `mir_instructions`.
27mir_extra: std.ArrayListUnmanaged(u32) = .empty,27mir_extra: std.ArrayListUnmanaged(u32) = .empty,
28/// When the key is an enum type, this represents a `@tagName` function.28/// When the key is an enum type, this represents a `@tagName` function.