| author | |
| committer | |
| log | d69634c10d2e4ca4af834a0644136ac1af72cd26 |
| tree | 42aaaecbdaef93ad754ceeb1a0eb97f11681d1f7 |
| parent | f2084ab74a8279db4a4607d97d49d27b0acda4db |
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) { |
| 110 | 110 | ||
| 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) { |
| 488 | 488 | ||
| 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) { |
| 713 | 713 | ||
| 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; |
| 17 | const Value = @import("Value.zig"); | 17 | const Value = @import("Value.zig"); |
| 18 | 18 | ||
| 19 | const WipSwitch = struct { | 19 | const 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, |
| 23 | 23 |
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 | }; |
| 43 | 43 | ||
| 44 | map: std.AutoHashMapUnmanaged(Identifier, Index) = .{}, | 44 | map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty, |
| 45 | /// Used for computing union/intersection of two lists; stored here so that allocations can be retained | 45 | /// Used for computing union/intersection of two lists; stored here so that allocations can be retained |
| 46 | /// until hideset is deinit'ed | 46 | /// until hideset is deinit'ed |
| 47 | tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{}, | 47 | tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty, |
| 48 | linked_list: Item.List = .{}, | 48 | linked_list: Item.List = .empty, |
| 49 | comp: *const Compilation, | 49 | comp: *const Compilation, |
| 50 | 50 | ||
| 51 | /// Invalidated if the underlying MultiArrayList slice is reallocated due to resize | 51 | /// 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, |
| 183 | 183 | ||
| 184 | pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8); | 184 | pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8); |
| 185 | 185 |
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, |
| 91 | 91 | ||
| 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 is | 93 | /// 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( |
| 100 | 100 | ||
| 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 | }; |
| 106 | 106 | ||
| ... | @@ -165,7 +165,7 @@ pub fn Custom( | ... | @@ -165,7 +165,7 @@ pub fn Custom( |
| 165 | const Oom = Allocator.Error; | 165 | const Oom = Allocator.Error; |
| 166 | 166 | ||
| 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); |
| 842 | 842 |
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 | } |
| 233 | 233 | ||
| ... | @@ -496,7 +496,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -496,7 +496,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 496 | 496 | ||
| 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 | } |
| 501 | 501 | ||
| 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 to | 21 | /// 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. |
| 23 | nodes_need_rl: *const AstRlAnnotate.RlNeededSet, | 23 | nodes_need_rl: *const AstRlAnnotate.RlNeededSet, |
| 24 | instructions: std.MultiArrayList(Zir.Inst) = .{}, | 24 | instructions: std.MultiArrayList(Zir.Inst) = .empty, |
| 25 | extra: ArrayList(u32) = .empty, | 25 | extra: ArrayList(u32) = .empty, |
| 26 | string_bytes: ArrayList(u8) = .empty, | 26 | string_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 | } |
| 1430 | 1430 | ||
| 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); |
| 14715 | 14715 | ||
| 14716 | // PARAMATTR_GROUP_BLOCK | 14716 | // 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. |
| 45 | arena: Allocator, | 45 | arena: Allocator, |
| 46 | code: Zir, | 46 | code: Zir, |
| 47 | air_instructions: std.MultiArrayList(Air.Inst) = .{}, | 47 | air_instructions: std.MultiArrayList(Air.Inst) = .empty, |
| 48 | air_extra: std.ArrayList(u32) = .empty, | 48 | air_extra: std.ArrayList(u32) = .empty, |
| 49 | /// Maps ZIR to AIR. | 49 | /// Maps ZIR to AIR. |
| 50 | inst_map: InstMap = .{}, | 50 | inst_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 | }; |
| 166 | 166 | ||
| 167 | const ComptimeAlloc = struct { | 167 | const 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 includes | 214 | /// All currently known errors that this error set contains. This includes |
| 215 | /// direct additions via `return error.Foo;`, and possibly also errors that | 215 | /// 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 is | 364 | /// 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, |
| 367 | 367 | ||
| 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); |
| 3040 | 3040 | ||
| 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); |
| 3043 | 3043 | ||
| 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( |
| 8440 | 8440 | ||
| 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 | } |
| 11544 | 11544 | ||
| 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); |
| 34516 | 34516 | ||
| 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, |
| 102 | multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct { | 102 | multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct { |
| 103 | index: u32, | 103 | index: u32, |
| 104 | len: u32, | 104 | len: u32, |
| 105 | }) = .{}, | 105 | }) = .empty, |
| 106 | 106 | ||
| 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. |
| 108 | builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Module) = .empty, | 108 | 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 { | ... | @@ -3050,7 +3050,7 @@ pub fn loadZirCache(gpa: Allocator, io: Io, cache_file: Io.File) !Zir { |
| 3050 | } | 3050 | } |
| 3051 | 3051 | ||
| 3052 | pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader) !Zir { | 3052 | pub 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); |
| 3055 | 3055 | ||
| 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( |
| 1360 | 1360 | ||
| 1361 | const have_block_result = inst_ty.hasRuntimeBits(zcu); | 1361 | const have_block_result = inst_ty.hasRuntimeBits(zcu); |
| 1362 | 1362 | ||
| 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); |
| 1365 | 1365 | ||
| 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, |
| 78 | fn_type: Type, | 78 | fn_type: Type, |
| 79 | arg_index: usize, | 79 | arg_index: usize, |
| 80 | 80 | ||
| 81 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 81 | mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, |
| 82 | 82 | ||
| 83 | owner: Owner, | 83 | owner: Owner, |
| 84 | 84 | ||
| ... | @@ -112,19 +112,19 @@ vtype: ?bits.VType, | ... | @@ -112,19 +112,19 @@ vtype: ?bits.VType, |
| 112 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, | 112 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 113 | register_manager: RegisterManager = .{}, | 113 | register_manager: RegisterManager = .{}, |
| 114 | 114 | ||
| 115 | const_tracking: ConstTrackingMap = .{}, | 115 | const_tracking: ConstTrackingMap = .empty, |
| 116 | inst_tracking: InstTrackingMap = .{}, | 116 | inst_tracking: InstTrackingMap = .empty, |
| 117 | 117 | ||
| 118 | frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, | 118 | frame_allocs: std.MultiArrayList(FrameAlloc) = .empty, |
| 119 | free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty, | 119 | free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty, |
| 120 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, | 120 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .empty, |
| 121 | 121 | ||
| 122 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { | 122 | loops: 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, |
| 128 | 128 | ||
| 129 | /// Debug field, used to find bugs in the compiler. | 129 | /// Debug field, used to find bugs in the compiler. |
| 130 | air_bookkeeping: @TypeOf(air_bookkeeping_init) = air_bookkeeping_init, | 130 | air_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, |
| 66 | stack_align: Alignment, | 66 | stack_align: Alignment, |
| 67 | 67 | ||
| 68 | /// MIR Instructions | 68 | /// MIR Instructions |
| 69 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 69 | mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, |
| 70 | /// MIR extra data | 70 | /// MIR extra data |
| 71 | mir_extra: std.ArrayList(u32) = .empty, | 71 | mir_extra: std.ArrayList(u32) = .empty, |
| 72 | 72 | ||
| ... | @@ -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 { |
| 1490 | 1490 | ||
| 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; |
| 1494 | 1494 | ||
| 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, |
| 144 | blocks: std.array_hash_map.Auto(Air.Inst.Index, struct { | 144 | blocks: 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. |
| 149 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty, | 149 | loops: 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, |
| 22 | 22 | ||
| 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. |
| 25 | files: std.MultiArrayList(File.Entry) = .{}, | 25 | files: 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-use | 27 | /// 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, |
| 33 | shared_objects: std.array_hash_map.String(File.Index) = .empty, | 33 | shared_objects: std.array_hash_map.String(File.Index) = .empty, |
| 34 | 34 | ||
| 35 | /// List of all output sections and their associated metadata. | 35 | /// List of all output sections and their associated metadata. |
| 36 | sections: std.MultiArrayList(Section) = .{}, | 36 | sections: std.MultiArrayList(Section) = .empty, |
| 37 | /// File offset into the shdr table. | 37 | /// File offset into the shdr table. |
| 38 | shdr_table_offset: ?u64 = null, | 38 | shdr_table_offset: ?u64 = null, |
| 39 | 39 |
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, |
| 8 | basename: []const u8, | 8 | basename: []const u8, |
| 9 | index: File.Index, | 9 | index: File.Index, |
| 10 | 10 | ||
| 11 | symtab: std.MultiArrayList(ElfSym) = .{}, | 11 | symtab: std.MultiArrayList(ElfSym) = .empty, |
| 12 | strtab: StringTable = .{}, | 12 | strtab: StringTable = .{}, |
| 13 | symbols: std.ArrayList(Symbol) = .empty, | 13 | symbols: std.ArrayList(Symbol) = .empty, |
| 14 | symbols_extra: std.ArrayList(u32) = .empty, | 14 | symbols_extra: std.ArrayList(u32) = .empty, |
| ... | @@ -30,16 +30,16 @@ output_ar_state: Archive.ArState = .{}, | ... | @@ -30,16 +30,16 @@ output_ar_state: Archive.ArState = .{}, |
| 30 | dwarf: ?Dwarf = null, | 30 | dwarf: ?Dwarf = null, |
| 31 | 31 | ||
| 32 | /// Table of tracked LazySymbols. | 32 | /// Table of tracked LazySymbols. |
| 33 | lazy_syms: LazySymbolTable = .{}, | 33 | lazy_syms: LazySymbolTable = .empty, |
| 34 | 34 | ||
| 35 | /// Table of tracked `Nav`s. | 35 | /// Table of tracked `Nav`s. |
| 36 | navs: NavTable = .{}, | 36 | navs: NavTable = .empty, |
| 37 | 37 | ||
| 38 | /// TLS variables indexed by Atom.Index. | 38 | /// TLS variables indexed by Atom.Index. |
| 39 | tls_variables: TlsTable = .{}, | 39 | tls_variables: TlsTable = .empty, |
| 40 | 40 | ||
| 41 | /// Table of tracked `Uav`s. | 41 | /// Table of tracked `Uav`s. |
| 42 | uavs: UavTable = .{}, | 42 | uavs: UavTable = .empty, |
| 43 | 43 | ||
| 44 | debug_info_section_dirty: bool = false, | 44 | debug_info_section_dirty: bool = false, |
| 45 | debug_abbrev_section_dirty: bool = false, | 45 | debug_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 file | 15 | /// Index of each input file also encodes the priority or precedence of one input file |
| 16 | /// over another. | 16 | /// over another. |
| 17 | files: std.MultiArrayList(File.Entry) = .{}, | 17 | files: 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-use | 19 | /// 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, |
| 25 | dylibs: std.ArrayList(File.Index) = .empty, | 25 | dylibs: std.ArrayList(File.Index) = .empty, |
| 26 | 26 | ||
| 27 | segments: std.ArrayList(macho.segment_command_64) = .empty, | 27 | segments: std.ArrayList(macho.segment_command_64) = .empty, |
| 28 | sections: std.MultiArrayList(Section) = .{}, | 28 | sections: std.MultiArrayList(Section) = .empty, |
| 29 | /// Populated by `allocateSections`. | 29 | /// Populated by `allocateSections`. |
| 30 | header_size: ?u32 = null, | 30 | header_size: ?u32 = null, |
| 31 | 31 |
src/link/MachO/Dylib.zig+1-1| ... | @@ -5,7 +5,7 @@ index: File.Index, | ... | @@ -5,7 +5,7 @@ index: File.Index, |
| 5 | file_handle: File.HandleIndex, | 5 | file_handle: File.HandleIndex, |
| 6 | tag: enum { dylib, tbd }, | 6 | tag: enum { dylib, tbd }, |
| 7 | 7 | ||
| 8 | exports: std.MultiArrayList(Export) = .{}, | 8 | exports: std.MultiArrayList(Export) = .empty, |
| 9 | strtab: std.ArrayList(u8) = .empty, | 9 | strtab: std.ArrayList(u8) = .empty, |
| 10 | id: ?Id = null, | 10 | id: ?Id = null, |
| 11 | ordinal: u16 = 0, | 11 | ordinal: u16 = 0, |
src/link/MachO/InternalObject.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | index: File.Index, | 1 | index: File.Index, |
| 2 | 2 | ||
| 3 | sections: std.MultiArrayList(Section) = .{}, | 3 | sections: std.MultiArrayList(Section) = .empty, |
| 4 | atoms: std.ArrayList(Atom) = .empty, | 4 | atoms: std.ArrayList(Atom) = .empty, |
| 5 | atoms_indexes: std.ArrayList(Atom.Index) = .empty, | 5 | atoms_indexes: std.ArrayList(Atom.Index) = .empty, |
| 6 | atoms_extra: std.ArrayList(u32) = .empty, | 6 | atoms_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, |
| 38 | in_archive: ?InArchive = null, | 38 | in_archive: ?InArchive = null, |
| 39 | 39 | ||
| 40 | header: ?macho.mach_header_64 = null, | 40 | header: ?macho.mach_header_64 = null, |
| 41 | sections: std.MultiArrayList(Section) = .{}, | 41 | sections: std.MultiArrayList(Section) = .empty, |
| 42 | symtab: std.MultiArrayList(Nlist) = .{}, | 42 | symtab: std.MultiArrayList(Nlist) = .empty, |
| 43 | strtab: std.ArrayList(u8) = .empty, | 43 | strtab: std.ArrayList(u8) = .empty, |
| 44 | 44 | ||
| 45 | symbols: std.ArrayList(Symbol) = .empty, | 45 | symbols: 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, |
| 17 | atoms_extra: std.ArrayList(u32) = .empty, | 17 | atoms_extra: std.ArrayList(u32) = .empty, |
| 18 | 18 | ||
| 19 | /// Table of tracked LazySymbols. | 19 | /// Table of tracked LazySymbols. |
| 20 | lazy_syms: LazySymbolTable = .{}, | 20 | lazy_syms: LazySymbolTable = .empty, |
| 21 | 21 | ||
| 22 | /// Table of tracked Navs. | 22 | /// Table of tracked Navs. |
| 23 | navs: NavTable = .{}, | 23 | navs: NavTable = .empty, |
| 24 | 24 | ||
| 25 | /// Table of tracked Uavs. | 25 | /// Table of tracked Uavs. |
| 26 | uavs: UavTable = .{}, | 26 | uavs: UavTable = .empty, |
| 27 | 27 | ||
| 28 | /// TLV initializers indexed by Atom.Index. | 28 | /// TLV initializers indexed by Atom.Index. |
| 29 | tlv_initializers: TlvInitializerTable = .{}, | 29 | tlv_initializers: TlvInitializerTable = .empty, |
| 30 | 30 | ||
| 31 | /// A table of relocations. | 31 | /// A table of relocations. |
| 32 | relocs: RelocationTable = .empty, | 32 | relocs: 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. |
| 33 | root: ?Node.Index = null, | 33 | root: ?Node.Index = null, |
| 34 | buffer: std.ArrayList(u8) = .empty, | 34 | buffer: std.ArrayList(u8) = .empty, |
| 35 | nodes: std.MultiArrayList(Node) = .{}, | 35 | nodes: std.MultiArrayList(Node) = .empty, |
| 36 | edges: std.ArrayList(Edge) = .empty, | 36 | edges: std.ArrayList(Edge) = .empty, |
| 37 | 37 | ||
| 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"); |
| 22 | 22 | ||
| 23 | base: link.File, | 23 | base: link.File, |
| 24 | /// All MIR instructions for all Zcu functions. | 24 | /// All MIR instructions for all Zcu functions. |
| 25 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 25 | mir_instructions: std.MultiArrayList(Mir.Inst) = .empty, |
| 26 | /// Corresponds to `mir_instructions`. | 26 | /// Corresponds to `mir_instructions`. |
| 27 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, | 27 | mir_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. |