authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-09-12 19:50:38+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-09-12 19:50:38+01:00
log0001f91e4e1e51cd64cdd5c0a21451c8bad67233
tree9c3efb262890fa76a9b1d02c694dadad11c316f4
parentb95e0e09dcbe4ca948fd4098a8e3a4d90df9cb22
parent9271a89c65967ff0fed7011b4195abdd0f9195eb
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21287 from linusg/deprecated-default-init

Replace deprecated default initializations with decl literals

152 files changed, 842 insertions(+), 824 deletions(-)

doc/langref/wasi_args.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
4 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 const gpa = general_purpose_allocator.allocator();
66 const args = try std.process.argsAlloc(gpa);
77 defer std.process.argsFree(gpa, args);
doc/langref/wasi_preopens.zig+1-1
......@@ -2,7 +2,7 @@ const std = @import("std");
22const fs = std.fs;
33
44pub fn main() !void {
5 var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
5 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
66 const gpa = general_purpose_allocator.allocator();
77
88 var arena_instance = std.heap.ArenaAllocator.init(gpa);
lib/compiler/aro/aro/CodeGen.zig+5-5
......@@ -42,11 +42,11 @@ node_tag: []const Tree.Tag,
4242node_data: []const Tree.Node.Data,
4343node_ty: []const Type,
4444wip_switch: *WipSwitch = undefined,
45symbols: std.ArrayListUnmanaged(Symbol) = .{},
46ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
47phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
48record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},
49record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{},
45symbols: std.ArrayListUnmanaged(Symbol) = .empty,
46ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
47phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
48record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty,
49record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty,
5050cond_dummy_ty: ?Interner.Ref = null,
5151bool_invert: bool = false,
5252bool_end_label: Ir.Ref = .none,
lib/compiler/aro/aro/Compilation.zig+5-5
......@@ -93,13 +93,13 @@ gpa: Allocator,
9393diagnostics: Diagnostics,
9494
9595environment: Environment = .{},
96sources: std.StringArrayHashMapUnmanaged(Source) = .{},
97include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
98system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
96sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
97include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
98system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
9999target: std.Target = @import("builtin").target,
100pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},
100pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
101101langopts: LangOpts = .{},
102generated_buf: std.ArrayListUnmanaged(u8) = .{},
102generated_buf: std.ArrayListUnmanaged(u8) = .empty,
103103builtins: Builtins = .{},
104104types: struct {
105105 wchar: Type = undefined,
lib/compiler/aro/aro/Diagnostics.zig+1-1
......@@ -221,7 +221,7 @@ pub const Options = struct {
221221
222222const Diagnostics = @This();
223223
224list: std.ArrayListUnmanaged(Message) = .{},
224list: std.ArrayListUnmanaged(Message) = .empty,
225225arena: std.heap.ArenaAllocator,
226226fatal_errors: bool = false,
227227options: Options = .{},
lib/compiler/aro/aro/Driver.zig+2-2
......@@ -25,8 +25,8 @@ pub const Linker = enum {
2525const Driver = @This();
2626
2727comp: *Compilation,
28inputs: std.ArrayListUnmanaged(Source) = .{},
29link_objects: std.ArrayListUnmanaged([]const u8) = .{},
28inputs: std.ArrayListUnmanaged(Source) = .empty,
29link_objects: std.ArrayListUnmanaged([]const u8) = .empty,
3030output_name: ?[]const u8 = null,
3131sysroot: ?[]const u8 = null,
3232system_defines: Compilation.SystemDefinesMode = .include_system_defines,
lib/compiler/aro/aro/Hideset.zig+2-2
......@@ -51,10 +51,10 @@ pub const Index = enum(u32) {
5151 _,
5252};
5353
54map: std.AutoHashMapUnmanaged(Identifier, Index) = .{},
54map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty,
5555/// Used for computing union/intersection of two lists; stored here so that allocations can be retained
5656/// until hideset is deinit'ed
57tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{},
57tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty,
5858linked_list: Item.List = .{},
5959comp: *const Compilation,
6060
lib/compiler/aro/aro/InitList.zig+1-1
......@@ -23,7 +23,7 @@ const Item = struct {
2323
2424const InitList = @This();
2525
26list: std.ArrayListUnmanaged(Item) = .{},
26list: std.ArrayListUnmanaged(Item) = .empty,
2727node: NodeIndex = .none,
2828tok: TokenIndex = 0,
2929
lib/compiler/aro/aro/Parser.zig+3-3
......@@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param),
109109enum_buf: std.ArrayList(Type.Enum.Field),
110110record_buf: std.ArrayList(Type.Record.Field),
111111attr_buf: std.MultiArrayList(TentativeAttribute) = .{},
112attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{},
112attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
113113field_attr_buf: std.ArrayList([]const Attribute),
114114/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
115115/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
......@@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute),
117117/// Items are removed if the type is subsequently completed with a definition.
118118/// We only store the first tentative definition that uses a given type because this map is only used
119119/// for issuing an error message, and correcting the first error for a type will fix all of them for that type.
120tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{},
120tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty,
121121
122122// configuration and miscellaneous info
123123no_eval: bool = false,
......@@ -174,7 +174,7 @@ record: struct {
174174 }
175175 }
176176} = .{},
177record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
177record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty,
178178@"switch": ?*Switch = null,
179179in_loop: bool = false,
180180pragma_pack: ?u8 = null,
lib/compiler/aro/aro/Preprocessor.zig+1-1
......@@ -95,7 +95,7 @@ counter: u32 = 0,
9595expansion_source_loc: Source.Location = undefined,
9696poisoned_identifiers: std.StringHashMap(void),
9797/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
98include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
98include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,
9999
100100/// Store `keyword_define` and `keyword_undef` tokens.
101101/// Used to implement preprocessor debug dump options
lib/compiler/aro/aro/SymbolStack.zig+3-3
......@@ -33,14 +33,14 @@ pub const Kind = enum {
3333 constexpr,
3434};
3535
36scopes: std.ArrayListUnmanaged(Scope) = .{},
36scopes: std.ArrayListUnmanaged(Scope) = .empty,
3737/// allocations from nested scopes are retained after popping; `active_len` is the number
3838/// of currently-active items in `scopes`.
3939active_len: usize = 0,
4040
4141const Scope = struct {
42 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
43 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
42 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
43 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
4444
4545 fn deinit(self: *Scope, allocator: Allocator) void {
4646 self.vars.deinit(allocator);
lib/compiler/aro/aro/pragmas/gcc.zig+1-1
......@@ -19,7 +19,7 @@ pragma: Pragma = .{
1919 .preserveTokens = preserveTokens,
2020},
2121original_options: Diagnostics.Options = .{},
22options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{},
22options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .empty,
2323
2424const Directive = enum {
2525 warning,
lib/compiler/aro/aro/pragmas/pack.zig+1-1
......@@ -15,7 +15,7 @@ pragma: Pragma = .{
1515 .parserHandler = parserHandler,
1616 .preserveTokens = preserveTokens,
1717},
18stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{},
18stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .empty,
1919
2020pub fn init(allocator: mem.Allocator) !*Pragma {
2121 var pack = try allocator.create(Pack);
lib/compiler/aro/aro/toolchains/Linux.zig+1-1
......@@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults");
1111const Linux = @This();
1212
1313distro: Distro.Tag = .unknown,
14extra_opts: std.ArrayListUnmanaged([]const u8) = .{},
14extra_opts: std.ArrayListUnmanaged([]const u8) = .empty,
1515gcc_detector: GCCDetector = .{},
1616
1717pub fn discover(self: *Linux, tc: *Toolchain) !void {
lib/compiler/aro/backend/Interner.zig+4-4
......@@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;
88
99const Interner = @This();
1010
11map: std.AutoArrayHashMapUnmanaged(void, void) = .{},
11map: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
1212items: std.MultiArrayList(struct {
1313 tag: Tag,
1414 data: u32,
1515}) = .{},
16extra: std.ArrayListUnmanaged(u32) = .{},
17limbs: std.ArrayListUnmanaged(Limb) = .{},
18strings: std.ArrayListUnmanaged(u8) = .{},
16extra: std.ArrayListUnmanaged(u32) = .empty,
17limbs: std.ArrayListUnmanaged(Limb) = .empty,
18strings: std.ArrayListUnmanaged(u8) = .empty,
1919
2020const KeyAdapter = struct {
2121 interner: *const Interner,
lib/compiler/aro/backend/Ir.zig+2-2
......@@ -26,9 +26,9 @@ pub const Builder = struct {
2626 arena: std.heap.ArenaAllocator,
2727 interner: *Interner,
2828
29 decls: std.StringArrayHashMapUnmanaged(Decl) = .{},
29 decls: std.StringArrayHashMapUnmanaged(Decl) = .empty,
3030 instructions: std.MultiArrayList(Ir.Inst) = .{},
31 body: std.ArrayListUnmanaged(Ref) = .{},
31 body: std.ArrayListUnmanaged(Ref) = .empty,
3232 alloc_count: u32 = 0,
3333 arg_count: u32 = 0,
3434 current_label: Ref = undefined,
lib/compiler/aro/backend/Object/Elf.zig+4-4
......@@ -5,7 +5,7 @@ const Object = @import("../Object.zig");
55
66const Section = struct {
77 data: std.ArrayList(u8),
8 relocations: std.ArrayListUnmanaged(Relocation) = .{},
8 relocations: std.ArrayListUnmanaged(Relocation) = .empty,
99 flags: u64,
1010 type: u32,
1111 index: u16 = undefined,
......@@ -37,9 +37,9 @@ const Elf = @This();
3737
3838obj: Object,
3939/// The keys are owned by the Codegen.tree
40sections: std.StringHashMapUnmanaged(*Section) = .{},
41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
40sections: std.StringHashMapUnmanaged(*Section) = .empty,
41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
4343unnamed_symbol_mangle: u32 = 0,
4444strtab_len: u64 = strtab_default.len,
4545arena: std.heap.ArenaAllocator,
lib/compiler/aro_translate_c.zig+8-8
......@@ -16,22 +16,22 @@ const Context = @This();
1616
1717gpa: mem.Allocator,
1818arena: mem.Allocator,
19decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{},
19decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty,
2020alias_list: AliasList,
2121global_scope: *Scope.Root,
2222mangle_count: u32 = 0,
2323/// Table of record decls that have been demoted to opaques.
24opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{},
24opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty,
2525/// Table of unnamed enums and records that are child types of typedefs.
26unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{},
26unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty,
2727/// Needed to decide if we are parsing a typename
28typedefs: std.StringArrayHashMapUnmanaged(void) = .{},
28typedefs: std.StringArrayHashMapUnmanaged(void) = .empty,
2929
3030/// This one is different than the root scope's name table. This contains
3131/// a list of names that we found by visiting all the top level decls without
3232/// translating them. The other maps are updated as we translate; this one is updated
3333/// up front in a pre-processing step.
34global_names: std.StringArrayHashMapUnmanaged(void) = .{},
34global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
3535
3636/// This is similar to `global_names`, but contains names which we would
3737/// *like* to use, but do not strictly *have* to if they are unavailable.
......@@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{},
4040/// may be mangled.
4141/// This is distinct from `global_names` so we can detect at a type
4242/// declaration whether or not the name is available.
43weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{},
43weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
4444
4545pattern_list: PatternList,
4646tree: Tree,
......@@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_
697697}
698698
699699fn getTypeStr(c: *Context, ty: Type) ![]const u8 {
700 var buf: std.ArrayListUnmanaged(u8) = .{};
700 var buf: std.ArrayListUnmanaged(u8) = .empty;
701701 defer buf.deinit(c.gpa);
702702 const w = buf.writer(c.gpa);
703703 try ty.print(c.mapper, c.comp.langopts, w);
......@@ -1793,7 +1793,7 @@ pub fn main() !void {
17931793 defer arena_instance.deinit();
17941794 const arena = arena_instance.allocator();
17951795
1796 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
1796 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
17971797 const gpa = general_purpose_allocator.allocator();
17981798
17991799 const args = try std.process.argsAlloc(arena);
lib/compiler/aro_translate_c/ast.zig+1-1
......@@ -808,7 +808,7 @@ const Context = struct {
808808 gpa: Allocator,
809809 buf: std.ArrayList(u8),
810810 nodes: std.zig.Ast.NodeList = .{},
811 extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .{},
811 extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .empty,
812812 tokens: std.zig.Ast.TokenList = .{},
813813
814814 fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex {
lib/compiler/build_runner.zig+2-2
......@@ -336,7 +336,7 @@ pub fn main() !void {
336336 }
337337
338338 if (graph.needed_lazy_dependencies.entries.len != 0) {
339 var buffer: std.ArrayListUnmanaged(u8) = .{};
339 var buffer: std.ArrayListUnmanaged(u8) = .empty;
340340 for (graph.needed_lazy_dependencies.keys()) |k| {
341341 try buffer.appendSlice(arena, k);
342342 try buffer.append(arena, '\n');
......@@ -1173,7 +1173,7 @@ pub fn printErrorMessages(
11731173 // Provide context for where these error messages are coming from by
11741174 // printing the corresponding Step subtree.
11751175
1176 var step_stack: std.ArrayListUnmanaged(*Step) = .{};
1176 var step_stack: std.ArrayListUnmanaged(*Step) = .empty;
11771177 defer step_stack.deinit(gpa);
11781178 try step_stack.append(gpa, failing_step);
11791179 while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) {
lib/compiler/objcopy.zig+1-1
......@@ -15,7 +15,7 @@ pub fn main() !void {
1515 defer arena_instance.deinit();
1616 const arena = arena_instance.allocator();
1717
18 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
18 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
1919 const gpa = general_purpose_allocator.allocator();
2020
2121 const args = try std.process.argsAlloc(arena);
lib/compiler/reduce.zig+2-2
......@@ -51,7 +51,7 @@ pub fn main() !void {
5151 defer arena_instance.deinit();
5252 const arena = arena_instance.allocator();
5353
54 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
54 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
5555 const gpa = general_purpose_allocator.allocator();
5656
5757 const args = try std.process.argsAlloc(arena);
......@@ -109,7 +109,7 @@ pub fn main() !void {
109109 const root_source_file_path = opt_root_source_file_path orelse
110110 fatal("missing root source file path argument; see -h for usage", .{});
111111
112 var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .{};
112 var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .empty;
113113 try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1);
114114 interestingness_argv.appendAssumeCapacity(checker_path);
115115 interestingness_argv.appendSliceAssumeCapacity(argv);
lib/compiler/resinator/ast.zig+1-1
......@@ -28,7 +28,7 @@ pub const Tree = struct {
2828};
2929
3030pub const CodePageLookup = struct {
31 lookup: std.ArrayListUnmanaged(CodePage) = .{},
31 lookup: std.ArrayListUnmanaged(CodePage) = .empty,
3232 allocator: Allocator,
3333 default_code_page: CodePage,
3434
lib/compiler/resinator/cli.zig+4-4
......@@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void {
7070}
7171
7272pub const Diagnostics = struct {
73 errors: std.ArrayListUnmanaged(ErrorDetails) = .{},
73 errors: std.ArrayListUnmanaged(ErrorDetails) = .empty,
7474 allocator: Allocator,
7575
7676 pub const ErrorDetails = struct {
7777 arg_index: usize,
7878 arg_span: ArgSpan = .{},
79 msg: std.ArrayListUnmanaged(u8) = .{},
79 msg: std.ArrayListUnmanaged(u8) = .empty,
8080 type: Type = .err,
8181 print_args: bool = true,
8282
......@@ -132,13 +132,13 @@ pub const Options = struct {
132132 allocator: Allocator,
133133 input_filename: []const u8 = &[_]u8{},
134134 output_filename: []const u8 = &[_]u8{},
135 extra_include_paths: std.ArrayListUnmanaged([]const u8) = .{},
135 extra_include_paths: std.ArrayListUnmanaged([]const u8) = .empty,
136136 ignore_include_env_var: bool = false,
137137 preprocess: Preprocess = .yes,
138138 default_language_id: ?u16 = null,
139139 default_code_page: ?CodePage = null,
140140 verbose: bool = false,
141 symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .{},
141 symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty,
142142 null_terminate_string_table_strings: bool = false,
143143 max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints,
144144 silent_duplicate_control_ids: bool = false,
lib/compiler/resinator/compile.zig+5-5
......@@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" {
30043004}
30053005
30063006pub const FontDir = struct {
3007 fonts: std.ArrayListUnmanaged(Font) = .{},
3007 fonts: std.ArrayListUnmanaged(Font) = .empty,
30083008 /// To keep track of which ids are set and where they were set from
3009 ids: std.AutoHashMapUnmanaged(u16, Token) = .{},
3009 ids: std.AutoHashMapUnmanaged(u16, Token) = .empty,
30103010
30113011 pub const Font = struct {
30123012 id: u16,
......@@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct {
31123112 /// when the first STRINGTABLE for the language was defined, and all blocks for a given
31133113 /// language are written contiguously.
31143114 /// Using an ArrayHashMap here gives us this property for free.
3115 tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .{},
3115 tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .empty,
31163116
31173117 pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void {
31183118 self.tables.deinit(allocator);
......@@ -3143,10 +3143,10 @@ pub const StringTable = struct {
31433143 /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written
31443144 /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second).
31453145 /// Using an ArrayHashMap here gives us this property for free.
3146 blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .{},
3146 blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .empty,
31473147
31483148 pub const Block = struct {
3149 strings: std.ArrayListUnmanaged(Token) = .{},
3149 strings: std.ArrayListUnmanaged(Token) = .empty,
31503150 set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 },
31513151 memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING),
31523152 characteristics: u32,
lib/compiler/resinator/errors.zig+3-3
......@@ -13,10 +13,10 @@ const builtin = @import("builtin");
1313const native_endian = builtin.cpu.arch.endian();
1414
1515pub const Diagnostics = struct {
16 errors: std.ArrayListUnmanaged(ErrorDetails) = .{},
16 errors: std.ArrayListUnmanaged(ErrorDetails) = .empty,
1717 /// Append-only, cannot handle removing strings.
1818 /// Expects to own all strings within the list.
19 strings: std.ArrayListUnmanaged([]const u8) = .{},
19 strings: std.ArrayListUnmanaged([]const u8) = .empty,
2020 allocator: std.mem.Allocator,
2121
2222 pub fn init(allocator: std.mem.Allocator) Diagnostics {
......@@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con
968968const CorrespondingLines = struct {
969969 worth_printing_note: bool = true,
970970 worth_printing_lines: bool = true,
971 lines: std.ArrayListUnmanaged(u8) = .{},
971 lines: std.ArrayListUnmanaged(u8) = .empty,
972972 lines_is_error_message: bool = false,
973973
974974 pub fn init(allocator: std.mem.Allocator, cwd: std.fs.Dir, err_details: ErrorDetails, lines_for_comparison: []const u8, corresponding_span: SourceMappings.CorrespondingSpan, corresponding_file: []const u8) !CorrespondingLines {
lib/compiler/resinator/main.zig+5-5
......@@ -10,7 +10,7 @@ const renderErrorMessage = @import("utils.zig").renderErrorMessage;
1010const aro = @import("aro");
1111
1212pub fn main() !void {
13 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
13 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
1414 defer std.debug.assert(gpa.deinit() == .ok);
1515 const allocator = gpa.allocator();
1616
......@@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle(
432432 });
433433
434434 var cur_err: ?ErrorBundle.ErrorMessage = null;
435 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};
435 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
436436 defer cur_notes.deinit(gpa);
437437 for (diagnostics.errors.items) |err_details| {
438438 switch (err_details.type) {
......@@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle(
474474 try bundle.init(gpa);
475475 errdefer bundle.deinit();
476476
477 var msg_buf: std.ArrayListUnmanaged(u8) = .{};
477 var msg_buf: std.ArrayListUnmanaged(u8) = .empty;
478478 defer msg_buf.deinit(gpa);
479479 var cur_err: ?ErrorBundle.ErrorMessage = null;
480 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};
480 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
481481 defer cur_notes.deinit(gpa);
482482 for (diagnostics.errors.items) |err_details| {
483483 switch (err_details.type) {
......@@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle(
587587 var msg_writer = MsgWriter.init(gpa);
588588 defer msg_writer.deinit();
589589 var cur_err: ?ErrorBundle.ErrorMessage = null;
590 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};
590 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
591591 defer cur_notes.deinit(gpa);
592592 for (comp.diagnostics.list.items) |msg| {
593593 switch (msg.kind) {
lib/compiler/resinator/parse.zig+15-15
......@@ -111,7 +111,7 @@ pub const Parser = struct {
111111 /// current token is unchanged.
112112 /// The returned slice is allocated by the parser's arena
113113 fn parseCommonResourceAttributes(self: *Self) ![]Token {
114 var common_resource_attributes = std.ArrayListUnmanaged(Token){};
114 var common_resource_attributes: std.ArrayListUnmanaged(Token) = .empty;
115115 while (true) {
116116 const maybe_common_resource_attribute = try self.lookaheadToken(.normal);
117117 if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) {
......@@ -131,7 +131,7 @@ pub const Parser = struct {
131131 /// current token is unchanged.
132132 /// The returned slice is allocated by the parser's arena
133133 fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node {
134 var optional_statements = std.ArrayListUnmanaged(*Node){};
134 var optional_statements: std.ArrayListUnmanaged(*Node) = .empty;
135135 while (true) {
136136 const lookahead_token = try self.lookaheadToken(.normal);
137137 if (lookahead_token.id != .literal) break;
......@@ -445,7 +445,7 @@ pub const Parser = struct {
445445 const begin_token = self.state.token;
446446 try self.check(.begin);
447447
448 var accelerators = std.ArrayListUnmanaged(*Node){};
448 var accelerators: std.ArrayListUnmanaged(*Node) = .empty;
449449
450450 while (true) {
451451 const lookahead = try self.lookaheadToken(.normal);
......@@ -463,7 +463,7 @@ pub const Parser = struct {
463463
464464 const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } });
465465
466 var type_and_options = std.ArrayListUnmanaged(Token){};
466 var type_and_options: std.ArrayListUnmanaged(Token) = .empty;
467467 while (true) {
468468 if (!(try self.parseOptionalToken(.comma))) break;
469469
......@@ -528,7 +528,7 @@ pub const Parser = struct {
528528 const begin_token = self.state.token;
529529 try self.check(.begin);
530530
531 var controls = std.ArrayListUnmanaged(*Node){};
531 var controls: std.ArrayListUnmanaged(*Node) = .empty;
532532 defer controls.deinit(self.state.allocator);
533533 while (try self.parseControlStatement(resource)) |control_node| {
534534 // The number of controls must fit in a u16 in order for it to
......@@ -587,7 +587,7 @@ pub const Parser = struct {
587587 const begin_token = self.state.token;
588588 try self.check(.begin);
589589
590 var buttons = std.ArrayListUnmanaged(*Node){};
590 var buttons: std.ArrayListUnmanaged(*Node) = .empty;
591591 defer buttons.deinit(self.state.allocator);
592592 while (try self.parseToolbarButtonStatement()) |button_node| {
593593 // The number of buttons must fit in a u16 in order for it to
......@@ -645,7 +645,7 @@ pub const Parser = struct {
645645 const begin_token = self.state.token;
646646 try self.check(.begin);
647647
648 var items = std.ArrayListUnmanaged(*Node){};
648 var items: std.ArrayListUnmanaged(*Node) = .empty;
649649 defer items.deinit(self.state.allocator);
650650 while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| {
651651 try items.append(self.state.allocator, item_node);
......@@ -679,7 +679,7 @@ pub const Parser = struct {
679679 // common resource attributes must all be contiguous and come before optional-statements
680680 const common_resource_attributes = try self.parseCommonResourceAttributes();
681681
682 var fixed_info = std.ArrayListUnmanaged(*Node){};
682 var fixed_info: std.ArrayListUnmanaged(*Node) = .empty;
683683 while (try self.parseVersionStatement()) |version_statement| {
684684 try fixed_info.append(self.state.arena, version_statement);
685685 }
......@@ -688,7 +688,7 @@ pub const Parser = struct {
688688 const begin_token = self.state.token;
689689 try self.check(.begin);
690690
691 var block_statements = std.ArrayListUnmanaged(*Node){};
691 var block_statements: std.ArrayListUnmanaged(*Node) = .empty;
692692 while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| {
693693 try block_statements.append(self.state.arena, block_node);
694694 }
......@@ -1064,7 +1064,7 @@ pub const Parser = struct {
10641064
10651065 _ = try self.parseOptionalToken(.comma);
10661066
1067 var options = std.ArrayListUnmanaged(Token){};
1067 var options: std.ArrayListUnmanaged(Token) = .empty;
10681068 while (true) {
10691069 const option_token = try self.lookaheadToken(.normal);
10701070 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
......@@ -1099,7 +1099,7 @@ pub const Parser = struct {
10991099 }
11001100 try self.skipAnyCommas();
11011101
1102 var options = std.ArrayListUnmanaged(Token){};
1102 var options: std.ArrayListUnmanaged(Token) = .empty;
11031103 while (true) {
11041104 const option_token = try self.lookaheadToken(.normal);
11051105 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
......@@ -1114,7 +1114,7 @@ pub const Parser = struct {
11141114 const begin_token = self.state.token;
11151115 try self.check(.begin);
11161116
1117 var items = std.ArrayListUnmanaged(*Node){};
1117 var items: std.ArrayListUnmanaged(*Node) = .empty;
11181118 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {
11191119 try items.append(self.state.arena, item_node);
11201120 }
......@@ -1184,7 +1184,7 @@ pub const Parser = struct {
11841184 const begin_token = self.state.token;
11851185 try self.check(.begin);
11861186
1187 var items = std.ArrayListUnmanaged(*Node){};
1187 var items: std.ArrayListUnmanaged(*Node) = .empty;
11881188 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {
11891189 try items.append(self.state.arena, item_node);
11901190 }
......@@ -1341,7 +1341,7 @@ pub const Parser = struct {
13411341 const begin_token = self.state.token;
13421342 try self.check(.begin);
13431343
1344 var children = std.ArrayListUnmanaged(*Node){};
1344 var children: std.ArrayListUnmanaged(*Node) = .empty;
13451345 while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| {
13461346 try children.append(self.state.arena, value_node);
13471347 }
......@@ -1374,7 +1374,7 @@ pub const Parser = struct {
13741374 }
13751375
13761376 fn parseBlockValuesList(self: *Self, had_comma_before_first_value: bool) Error![]*Node {
1377 var values = std.ArrayListUnmanaged(*Node){};
1377 var values: std.ArrayListUnmanaged(*Node) = .empty;
13781378 var seen_number: bool = false;
13791379 var first_string_value: ?*Node = null;
13801380 while (true) {
lib/compiler/resinator/source_mapping.zig+3-3
......@@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct {
1010
1111const CurrentMapping = struct {
1212 line_num: usize = 1,
13 filename: std.ArrayListUnmanaged(u8) = .{},
13 filename: std.ArrayListUnmanaged(u8) = .empty,
1414 pending: bool = true,
1515 ignore_contents: bool = false,
1616};
......@@ -626,8 +626,8 @@ test "SourceMappings collapse" {
626626
627627/// Same thing as StringTable in Zig's src/Wasm.zig
628628pub const StringTable = struct {
629 data: std.ArrayListUnmanaged(u8) = .{},
630 map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .{},
629 data: std.ArrayListUnmanaged(u8) = .empty,
630 map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
631631
632632 pub fn deinit(self: *StringTable, allocator: Allocator) void {
633633 self.data.deinit(allocator);
lib/compiler/std-docs.zig+2-2
......@@ -25,7 +25,7 @@ pub fn main() !void {
2525 defer arena_instance.deinit();
2626 const arena = arena_instance.allocator();
2727
28 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
28 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
2929 const gpa = general_purpose_allocator.allocator();
3030
3131 var argv = try std.process.argsWithAllocator(arena);
......@@ -265,7 +265,7 @@ fn buildWasmBinary(
265265) !Cache.Path {
266266 const gpa = context.gpa;
267267
268 var argv: std.ArrayListUnmanaged([]const u8) = .{};
268 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
269269
270270 try argv.appendSlice(arena, &.{
271271 context.zig_exe_path, //
lib/compiler/test_runner.zig+1-1
......@@ -85,7 +85,7 @@ fn mainServer() !void {
8585 @panic("internal test runner memory leak");
8686 };
8787
88 var string_bytes: std.ArrayListUnmanaged(u8) = .{};
88 var string_bytes: std.ArrayListUnmanaged(u8) = .empty;
8989 defer string_bytes.deinit(testing.allocator);
9090 try string_bytes.append(testing.allocator, 0); // Reserve 0 for null.
9191
lib/docs/wasm/Walk.zig+10-10
......@@ -10,9 +10,9 @@ const Oom = error{OutOfMemory};
1010
1111pub const Decl = @import("Decl.zig");
1212
13pub var files: std.StringArrayHashMapUnmanaged(File) = .{};
14pub var decls: std.ArrayListUnmanaged(Decl) = .{};
15pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .{};
13pub var files: std.StringArrayHashMapUnmanaged(File) = .empty;
14pub var decls: std.ArrayListUnmanaged(Decl) = .empty;
15pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty;
1616
1717file: File.Index,
1818
......@@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) {
4242pub const File = struct {
4343 ast: Ast,
4444 /// Maps identifiers to the declarations they point to.
45 ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{},
45 ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty,
4646 /// Maps field access identifiers to the containing field access node.
47 token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{},
47 token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty,
4848 /// Maps declarations to their global index.
49 node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .{},
49 node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .empty,
5050 /// Maps function declarations to doctests.
51 doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{},
51 doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty,
5252 /// root node => its namespace scope
5353 /// struct/union/enum/opaque decl node => its namespace scope
5454 /// local var decl node => its local variable scope
55 scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .{},
55 scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .empty,
5656
5757 pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index {
5858 const decl_node = file.ident_decls.get(token) orelse return .none;
......@@ -464,8 +464,8 @@ pub const Scope = struct {
464464 const Namespace = struct {
465465 base: Scope = .{ .tag = .namespace },
466466 parent: *Scope,
467 names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{},
468 doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{},
467 names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty,
468 doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty,
469469 decl_index: Decl.Index,
470470 };
471471
lib/docs/wasm/html_render.zig+1-1
......@@ -38,7 +38,7 @@ pub fn fileSourceHtml(
3838 const file = file_index.get();
3939
4040 const g = struct {
41 var field_access_buffer: std.ArrayListUnmanaged(u8) = .{};
41 var field_access_buffer: std.ArrayListUnmanaged(u8) = .empty;
4242 };
4343
4444 const token_tags = ast.tokens.items(.tag);
lib/docs/wasm/main.zig+14-14
......@@ -60,8 +60,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {
6060 };
6161}
6262
63var query_string: std.ArrayListUnmanaged(u8) = .{};
64var query_results: std.ArrayListUnmanaged(Decl.Index) = .{};
63var query_string: std.ArrayListUnmanaged(u8) = .empty;
64var query_results: std.ArrayListUnmanaged(Decl.Index) = .empty;
6565
6666/// Resizes the query string to be the correct length; returns the pointer to
6767/// the query string.
......@@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void {
9393 segments: u16,
9494 };
9595 const g = struct {
96 var full_path_search_text: std.ArrayListUnmanaged(u8) = .{};
97 var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .{};
98 var doc_search_text: std.ArrayListUnmanaged(u8) = .{};
96 var full_path_search_text: std.ArrayListUnmanaged(u8) = .empty;
97 var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .empty;
98 var doc_search_text: std.ArrayListUnmanaged(u8) = .empty;
9999 /// Each element matches a corresponding query_results element.
100 var scores: std.ArrayListUnmanaged(Score) = .{};
100 var scores: std.ArrayListUnmanaged(Score) = .empty;
101101 };
102102
103103 // First element stores the size of the list.
......@@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) {
255255 }
256256};
257257
258var string_result: std.ArrayListUnmanaged(u8) = .{};
259var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .{};
258var string_result: std.ArrayListUnmanaged(u8) = .empty;
259var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .empty;
260260
261261export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) {
262262 return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM"));
......@@ -381,7 +381,7 @@ export fn decl_params(decl_index: Decl.Index) Slice(Ast.Node.Index) {
381381
382382fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
383383 const g = struct {
384 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{};
384 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty;
385385 };
386386 g.result.clearRetainingCapacity();
387387 const decl = decl_index.get();
......@@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
403403
404404fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
405405 const g = struct {
406 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{};
406 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty;
407407 };
408408 g.result.clearRetainingCapacity();
409409 const decl = decl_index.get();
......@@ -672,7 +672,7 @@ fn render_docs(
672672 defer parsed_doc.deinit(gpa);
673673
674674 const g = struct {
675 var link_buffer: std.ArrayListUnmanaged(u8) = .{};
675 var link_buffer: std.ArrayListUnmanaged(u8) = .empty;
676676 };
677677
678678 const Writer = std.ArrayListUnmanaged(u8).Writer;
......@@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index {
817817}
818818
819819/// Set by `set_input_string`.
820var input_string: std.ArrayListUnmanaged(u8) = .{};
820var input_string: std.ArrayListUnmanaged(u8) = .empty;
821821
822822export fn set_input_string(len: usize) [*]u8 {
823823 input_string.resize(gpa, len) catch @panic("OOM");
......@@ -839,7 +839,7 @@ export fn find_decl() Decl.Index {
839839 if (result != .none) return result;
840840
841841 const g = struct {
842 var match_fqn: std.ArrayListUnmanaged(u8) = .{};
842 var match_fqn: std.ArrayListUnmanaged(u8) = .empty;
843843 };
844844 for (Walk.decls.items, 0..) |*decl, decl_index| {
845845 g.match_fqn.clearRetainingCapacity();
......@@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl.
888888
889889export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) {
890890 const g = struct {
891 var members: std.ArrayListUnmanaged(Decl.Index) = .{};
891 var members: std.ArrayListUnmanaged(Decl.Index) = .empty;
892892 };
893893
894894 g.members.clearRetainingCapacity();
lib/docs/wasm/markdown/Parser.zig+7-7
......@@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData;
3131const StringIndex = Document.StringIndex;
3232
3333nodes: Node.List = .{},
34extra: std.ArrayListUnmanaged(u32) = .{},
35scratch_extra: std.ArrayListUnmanaged(u32) = .{},
36string_bytes: std.ArrayListUnmanaged(u8) = .{},
37scratch_string: std.ArrayListUnmanaged(u8) = .{},
38pending_blocks: std.ArrayListUnmanaged(Block) = .{},
34extra: std.ArrayListUnmanaged(u32) = .empty,
35scratch_extra: std.ArrayListUnmanaged(u32) = .empty,
36string_bytes: std.ArrayListUnmanaged(u8) = .empty,
37scratch_string: std.ArrayListUnmanaged(u8) = .empty,
38pending_blocks: std.ArrayListUnmanaged(Block) = .empty,
3939allocator: Allocator,
4040
4141const Parser = @This();
......@@ -928,8 +928,8 @@ const InlineParser = struct {
928928 parent: *Parser,
929929 content: []const u8,
930930 pos: usize = 0,
931 pending_inlines: std.ArrayListUnmanaged(PendingInline) = .{},
932 completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .{},
931 pending_inlines: std.ArrayListUnmanaged(PendingInline) = .empty,
932 completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .empty,
933933
934934 const PendingInline = struct {
935935 tag: Tag,
lib/fuzzer.zig+1-1
......@@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn {
402402 }
403403}
404404
405var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
405var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
406406
407407var fuzzer: Fuzzer = .{
408408 .gpa = general_purpose_allocator.allocator(),
lib/fuzzer/web/main.zig+10-10
......@@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 {
5858 return slice.ptr;
5959}
6060
61var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{};
61var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty;
6262
6363/// Resizes the message buffer to be the correct length; returns the pointer to
6464/// the query string.
......@@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {
9090}
9191
9292/// Set by `set_input_string`.
93var input_string: std.ArrayListUnmanaged(u8) = .{};
94var string_result: std.ArrayListUnmanaged(u8) = .{};
93var input_string: std.ArrayListUnmanaged(u8) = .empty;
94var string_result: std.ArrayListUnmanaged(u8) = .empty;
9595
9696export fn set_input_string(len: usize) [*]u8 {
9797 input_string.resize(gpa, len) catch @panic("OOM");
......@@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void {
249249 js.emitCoverageUpdate();
250250}
251251
252var entry_points: std.ArrayListUnmanaged(u32) = .{};
252var entry_points: std.ArrayListUnmanaged(u32) = .empty;
253253
254254fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void {
255255 const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*);
......@@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) {
295295 }
296296
297297 fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index {
298 var buf: std.ArrayListUnmanaged(u8) = .{};
298 var buf: std.ArrayListUnmanaged(u8) = .empty;
299299 defer buf.deinit(gpa);
300300 sli.appendPath(&buf) catch @panic("OOM");
301301 return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null);
......@@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) {
307307 ) error{ OutOfMemory, SourceUnavailable }!void {
308308 const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable;
309309 const root_node = walk_file_index.findRootDecl().get().ast_node;
310 var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .{};
310 var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .empty;
311311 defer annotations.deinit(gpa);
312312 try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items);
313313 html_render.fileSourceHtml(walk_file_index, out, root_node, .{
......@@ -327,7 +327,7 @@ fn computeSourceAnnotations(
327327 // Collect all the source locations from only this file into this array
328328 // first, then sort by line, col, so that we can collect annotations with
329329 // O(N) time complexity.
330 var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .{};
330 var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .empty;
331331 defer locs.deinit(gpa);
332332
333333 for (source_locations, 0..) |sl, sli_usize| {
......@@ -374,9 +374,9 @@ fn computeSourceAnnotations(
374374
375375var coverage = Coverage.init;
376376/// Index of type `SourceLocationIndex`.
377var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .{};
377var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .empty;
378378/// Contains the most recent coverage update message, unmodified.
379var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{};
379var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty;
380380
381381fn updateCoverage(
382382 directories: []const Coverage.String,
......@@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String {
425425
426426export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) {
427427 const global = struct {
428 var result: std.ArrayListUnmanaged(SourceLocationIndex) = .{};
428 var result: std.ArrayListUnmanaged(SourceLocationIndex) = .empty;
429429 fn add(i: u32, want_file: Coverage.File.Index) void {
430430 const src_loc_index: SourceLocationIndex = @enumFromInt(i);
431431 if (src_loc_index.ptr().file == want_file) result.appendAssumeCapacity(src_loc_index);
lib/std/Build.zig+2-2
......@@ -111,7 +111,7 @@ pub const ReleaseMode = enum {
111111/// Settings that are here rather than in Build are not configurable per-package.
112112pub const Graph = struct {
113113 arena: Allocator,
114 system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .{},
114 system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty,
115115 system_package_mode: bool = false,
116116 debug_compiler_runtime_libs: bool = false,
117117 cache: Cache,
......@@ -119,7 +119,7 @@ pub const Graph = struct {
119119 env_map: EnvMap,
120120 global_cache_root: Cache.Directory,
121121 zig_lib_directory: Cache.Directory,
122 needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .{},
122 needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty,
123123 /// Information about the native target. Computed before build() is invoked.
124124 host: ResolvedTarget,
125125 incremental: ?bool = null,
lib/std/Build/Fuzz.zig+1-1
......@@ -30,7 +30,7 @@ pub fn start(
3030 defer rebuild_node.end();
3131 var wait_group: std.Thread.WaitGroup = .{};
3232 defer wait_group.wait();
33 var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .{};
33 var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .empty;
3434 defer fuzz_run_steps.deinit(gpa);
3535 for (all_steps) |step| {
3636 const run = step.cast(Step.Run) orelse continue;
lib/std/Build/Fuzz/WebServer.zig+1-1
......@@ -236,7 +236,7 @@ fn buildWasmBinary(
236236 .sub_path = "docs/wasm/html_render.zig",
237237 };
238238
239 var argv: std.ArrayListUnmanaged([]const u8) = .{};
239 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
240240
241241 try argv.appendSlice(arena, &.{
242242 ws.zig_exe_path, "build-exe", //
lib/std/Build/Step.zig+1-1
......@@ -714,7 +714,7 @@ pub fn allocPrintCmd2(
714714 opt_env: ?*const std.process.EnvMap,
715715 argv: []const []const u8,
716716) Allocator.Error![]u8 {
717 var buf: std.ArrayListUnmanaged(u8) = .{};
717 var buf: std.ArrayListUnmanaged(u8) = .empty;
718718 if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd});
719719 if (opt_env) |env| {
720720 const process_env_map = std.process.getEnvMap(arena) catch std.process.EnvMap.init(arena);
lib/std/Build/Step/CheckObject.zig+8-8
......@@ -713,12 +713,12 @@ const MachODumper = struct {
713713 gpa: Allocator,
714714 data: []const u8,
715715 header: macho.mach_header_64,
716 segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},
717 sections: std.ArrayListUnmanaged(macho.section_64) = .{},
718 symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},
719 strtab: std.ArrayListUnmanaged(u8) = .{},
720 indsymtab: std.ArrayListUnmanaged(u32) = .{},
721 imports: std.ArrayListUnmanaged([]const u8) = .{},
716 segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
717 sections: std.ArrayListUnmanaged(macho.section_64) = .empty,
718 symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
719 strtab: std.ArrayListUnmanaged(u8) = .empty,
720 indsymtab: std.ArrayListUnmanaged(u32) = .empty,
721 imports: std.ArrayListUnmanaged([]const u8) = .empty,
722722
723723 fn parse(ctx: *ObjectContext) !void {
724724 var it = ctx.getLoadCommandIterator();
......@@ -1797,9 +1797,9 @@ const ElfDumper = struct {
17971797 const ArchiveContext = struct {
17981798 gpa: Allocator,
17991799 data: []const u8,
1800 symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .{},
1800 symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .empty,
18011801 strtab: []const u8,
1802 objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .{},
1802 objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .empty,
18031803
18041804 fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void {
18051805 var stream = std.io.fixedBufferStream(raw);
lib/std/Build/Step/Compile.zig+2-2
......@@ -1070,8 +1070,8 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
10701070 // Stores system libraries that have already been seen for at least one
10711071 // module, along with any arguments that need to be passed to the
10721072 // compiler for each module individually.
1073 var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .{};
1074 var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .{};
1073 var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .empty;
1074 var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .empty;
10751075
10761076 var prev_has_cflags = false;
10771077 var prev_has_rcflags = false;
lib/std/Build/Step/Fmt.zig+1-1
......@@ -48,7 +48,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
4848 const arena = b.allocator;
4949 const fmt: *Fmt = @fieldParentPtr("step", step);
5050
51 var argv: std.ArrayListUnmanaged([]const u8) = .{};
51 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
5252 try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len);
5353
5454 argv.appendAssumeCapacity(b.graph.zig_exe);
lib/std/Build/Step/Run.zig+1-1
......@@ -856,7 +856,7 @@ pub fn rerunInFuzzMode(
856856 const step = &run.step;
857857 const b = step.owner;
858858 const arena = b.allocator;
859 var argv_list: std.ArrayListUnmanaged([]const u8) = .{};
859 var argv_list: std.ArrayListUnmanaged([]const u8) = .empty;
860860 for (run.argv.items) |arg| {
861861 switch (arg) {
862862 .bytes => |bytes| {
lib/std/array_hash_map.zig+3-3
......@@ -130,7 +130,7 @@ pub fn ArrayHashMap(
130130 }
131131 pub fn initContext(allocator: Allocator, ctx: Context) Self {
132132 return .{
133 .unmanaged = .{},
133 .unmanaged = .empty,
134134 .allocator = allocator,
135135 .ctx = ctx,
136136 };
......@@ -429,7 +429,7 @@ pub fn ArrayHashMap(
429429 pub fn move(self: *Self) Self {
430430 self.unmanaged.pointer_stability.assertUnlocked();
431431 const result = self.*;
432 self.unmanaged = .{};
432 self.unmanaged = .empty;
433433 return result;
434434 }
435435
......@@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged(
12901290 pub fn move(self: *Self) Self {
12911291 self.pointer_stability.assertUnlocked();
12921292 const result = self.*;
1293 self.* = .{};
1293 self.* = .empty;
12941294 return result;
12951295 }
12961296
lib/std/array_list.zig+32-32
......@@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
710710 const old_memory = self.allocatedSlice();
711711 if (allocator.resize(old_memory, self.items.len)) {
712712 const result = self.items;
713 self.* = .{};
713 self.* = .empty;
714714 return result;
715715 }
716716
......@@ -1267,7 +1267,7 @@ test "init" {
12671267 }
12681268
12691269 {
1270 const list = ArrayListUnmanaged(i32){};
1270 const list: ArrayListUnmanaged(i32) = .empty;
12711271
12721272 try testing.expect(list.items.len == 0);
12731273 try testing.expect(list.capacity == 0);
......@@ -1312,7 +1312,7 @@ test "clone" {
13121312 try testing.expectEqual(@as(i32, 5), cloned.items[2]);
13131313 }
13141314 {
1315 var array = ArrayListUnmanaged(i32){};
1315 var array: ArrayListUnmanaged(i32) = .empty;
13161316 try array.append(a, -1);
13171317 try array.append(a, 3);
13181318 try array.append(a, 5);
......@@ -1384,7 +1384,7 @@ test "basic" {
13841384 try testing.expect(list.pop() == 33);
13851385 }
13861386 {
1387 var list = ArrayListUnmanaged(i32){};
1387 var list: ArrayListUnmanaged(i32) = .empty;
13881388 defer list.deinit(a);
13891389
13901390 {
......@@ -1448,7 +1448,7 @@ test "appendNTimes" {
14481448 }
14491449 }
14501450 {
1451 var list = ArrayListUnmanaged(i32){};
1451 var list: ArrayListUnmanaged(i32) = .empty;
14521452 defer list.deinit(a);
14531453
14541454 try list.appendNTimes(a, 2, 10);
......@@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" {
14671467 try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10));
14681468 }
14691469 {
1470 var list = ArrayListUnmanaged(i32){};
1470 var list: ArrayListUnmanaged(i32) = .empty;
14711471 defer list.deinit(a);
14721472 try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10));
14731473 }
......@@ -1502,7 +1502,7 @@ test "orderedRemove" {
15021502 try testing.expectEqual(@as(usize, 4), list.items.len);
15031503 }
15041504 {
1505 var list = ArrayListUnmanaged(i32){};
1505 var list: ArrayListUnmanaged(i32) = .empty;
15061506 defer list.deinit(a);
15071507
15081508 try list.append(a, 1);
......@@ -1537,7 +1537,7 @@ test "orderedRemove" {
15371537 }
15381538 {
15391539 // remove last item
1540 var list = ArrayListUnmanaged(i32){};
1540 var list: ArrayListUnmanaged(i32) = .empty;
15411541 defer list.deinit(a);
15421542 try list.append(a, 1);
15431543 try testing.expectEqual(@as(i32, 1), list.orderedRemove(0));
......@@ -1574,7 +1574,7 @@ test "swapRemove" {
15741574 try testing.expect(list.items.len == 4);
15751575 }
15761576 {
1577 var list = ArrayListUnmanaged(i32){};
1577 var list: ArrayListUnmanaged(i32) = .empty;
15781578 defer list.deinit(a);
15791579
15801580 try list.append(a, 1);
......@@ -1617,7 +1617,7 @@ test "insert" {
16171617 try testing.expect(list.items[3] == 3);
16181618 }
16191619 {
1620 var list = ArrayListUnmanaged(i32){};
1620 var list: ArrayListUnmanaged(i32) = .empty;
16211621 defer list.deinit(a);
16221622
16231623 try list.insert(a, 0, 1);
......@@ -1655,7 +1655,7 @@ test "insertSlice" {
16551655 try testing.expect(list.items[0] == 1);
16561656 }
16571657 {
1658 var list = ArrayListUnmanaged(i32){};
1658 var list: ArrayListUnmanaged(i32) = .empty;
16591659 defer list.deinit(a);
16601660
16611661 try list.append(a, 1);
......@@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" {
17891789 const a = testing.allocator;
17901790
17911791 {
1792 var list = ArrayListUnmanaged(i32){};
1792 var list: ArrayListUnmanaged(i32) = .empty;
17931793 defer list.deinit(a);
17941794 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
17951795
......@@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" {
17981798 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
17991799 }
18001800 {
1801 var list = ArrayListUnmanaged(i32){};
1801 var list: ArrayListUnmanaged(i32) = .empty;
18021802 defer list.deinit(a);
18031803 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18041804
......@@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" {
18111811 );
18121812 }
18131813 {
1814 var list = ArrayListUnmanaged(i32){};
1814 var list: ArrayListUnmanaged(i32) = .empty;
18151815 defer list.deinit(a);
18161816 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18171817
......@@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" {
18201820 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
18211821 }
18221822 {
1823 var list = ArrayListUnmanaged(i32){};
1823 var list: ArrayListUnmanaged(i32) = .empty;
18241824 defer list.deinit(a);
18251825 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18261826
......@@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" {
18291829 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
18301830 }
18311831 {
1832 var list = ArrayListUnmanaged(i32){};
1832 var list: ArrayListUnmanaged(i32) = .empty;
18331833 defer list.deinit(a);
18341834 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18351835
......@@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
18431843 const a = testing.allocator;
18441844
18451845 {
1846 var list = ArrayListUnmanaged(i32){};
1846 var list: ArrayListUnmanaged(i32) = .empty;
18471847 defer list.deinit(a);
18481848 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18491849
......@@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
18521852 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
18531853 }
18541854 {
1855 var list = ArrayListUnmanaged(i32){};
1855 var list: ArrayListUnmanaged(i32) = .empty;
18561856 defer list.deinit(a);
18571857 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18581858
......@@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
18651865 );
18661866 }
18671867 {
1868 var list = ArrayListUnmanaged(i32){};
1868 var list: ArrayListUnmanaged(i32) = .empty;
18691869 defer list.deinit(a);
18701870 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18711871
......@@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
18741874 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
18751875 }
18761876 {
1877 var list = ArrayListUnmanaged(i32){};
1877 var list: ArrayListUnmanaged(i32) = .empty;
18781878 defer list.deinit(a);
18791879 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18801880
......@@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
18831883 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
18841884 }
18851885 {
1886 var list = ArrayListUnmanaged(i32){};
1886 var list: ArrayListUnmanaged(i32) = .empty;
18871887 defer list.deinit(a);
18881888 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18891889
......@@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct {
19061906test "ArrayList(T) of struct T" {
19071907 const a = std.testing.allocator;
19081908 {
1909 var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(a) };
1909 var root = Item{ .integer = 1, .sub_items = .init(a) };
19101910 defer root.sub_items.deinit();
1911 try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(a) });
1911 try root.sub_items.append(Item{ .integer = 42, .sub_items = .init(a) });
19121912 try testing.expect(root.sub_items.items[0].integer == 42);
19131913 }
19141914 {
1915 var root = ItemUnmanaged{ .integer = 1, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} };
1915 var root = ItemUnmanaged{ .integer = 1, .sub_items = .empty };
19161916 defer root.sub_items.deinit(a);
1917 try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} });
1917 try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = .empty });
19181918 try testing.expect(root.sub_items.items[0].integer == 42);
19191919 }
19201920}
......@@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" {
19501950 const a = testing.allocator;
19511951
19521952 {
1953 var buffer: ArrayListUnmanaged(u8) = .{};
1953 var buffer: ArrayListUnmanaged(u8) = .empty;
19541954 defer buffer.deinit(a);
19551955
19561956 const x: i32 = 42;
......@@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" {
19601960 try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
19611961 }
19621962 {
1963 var list: ArrayListAlignedUnmanaged(u8, 2) = .{};
1963 var list: ArrayListAlignedUnmanaged(u8, 2) = .empty;
19641964 defer list.deinit(a);
19651965
19661966 const writer = list.writer(a);
......@@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" {
19891989 try testing.expect(list.items.len == 1);
19901990 }
19911991 {
1992 var list = ArrayListUnmanaged(i32){};
1992 var list: ArrayListUnmanaged(i32) = .empty;
19931993 defer list.deinit(a);
19941994
19951995 try list.append(a, 1);
......@@ -2026,7 +2026,7 @@ test "addManyAsArray" {
20262026 try testing.expectEqualSlices(u8, list.items, "aoeuasdf");
20272027 }
20282028 {
2029 var list = ArrayListUnmanaged(u8){};
2029 var list: ArrayListUnmanaged(u8) = .empty;
20302030 defer list.deinit(a);
20312031
20322032 (try list.addManyAsArray(a, 4)).* = "aoeu".*;
......@@ -2056,7 +2056,7 @@ test "growing memory preserves contents" {
20562056 try testing.expectEqualSlices(u8, list.items, "abcdijklefgh");
20572057 }
20582058 {
2059 var list = ArrayListUnmanaged(u8){};
2059 var list: ArrayListUnmanaged(u8) = .empty;
20602060 defer list.deinit(a);
20612061
20622062 (try list.addManyAsArray(a, 4)).* = "abcd".*;
......@@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" {
21322132 try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0));
21332133 }
21342134 {
2135 var list = ArrayListUnmanaged(u8){};
2135 var list: ArrayListUnmanaged(u8) = .empty;
21362136 defer list.deinit(a);
21372137
21382138 try list.appendSlice(a, "foobar");
......@@ -2156,7 +2156,7 @@ test "accepts unaligned slices" {
21562156 try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 });
21572157 }
21582158 {
2159 var list = std.ArrayListAlignedUnmanaged(u8, 8){};
2159 var list: std.ArrayListAlignedUnmanaged(u8, 8) = .empty;
21602160 defer list.deinit(a);
21612161
21622162 try list.appendSlice(a, &.{ 0, 1, 2, 3 });
lib/std/crypto/Certificate/Bundle.zig+2-2
......@@ -6,8 +6,8 @@
66//! certificate within `bytes`.
77
88/// The key is the contents slice of the subject.
9map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .{},
10bytes: std.ArrayListUnmanaged(u8) = .{},
9map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .empty,
10bytes: std.ArrayListUnmanaged(u8) = .empty,
1111
1212pub const VerifyError = Certificate.Parsed.VerifyError || error{
1313 CertificateIssuerNotFound,
lib/std/debug/Dwarf.zig+8-8
......@@ -42,20 +42,20 @@ sections: SectionArray = null_section_array,
4242is_macho: bool,
4343
4444/// Filled later by the initializer
45abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .{},
45abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty,
4646/// Filled later by the initializer
47compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .{},
47compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty,
4848/// Filled later by the initializer
49func_list: std.ArrayListUnmanaged(Func) = .{},
49func_list: std.ArrayListUnmanaged(Func) = .empty,
5050
5151eh_frame_hdr: ?ExceptionFrameHeader = null,
5252/// These lookup tables are only used if `eh_frame_hdr` is null
53cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .{},
53cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty,
5454/// Sorted by start_pc
55fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .{},
55fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty,
5656
5757/// Populated by `populateRanges`.
58ranges: std.ArrayListUnmanaged(Range) = .{},
58ranges: std.ArrayListUnmanaged(Range) = .empty,
5959
6060pub const Range = struct {
6161 start: u64,
......@@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) !
14641464
14651465 const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1);
14661466
1467 var directories: std.ArrayListUnmanaged(FileEntry) = .{};
1467 var directories: std.ArrayListUnmanaged(FileEntry) = .empty;
14681468 defer directories.deinit(gpa);
1469 var file_entries: std.ArrayListUnmanaged(FileEntry) = .{};
1469 var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty;
14701470 defer file_entries.deinit(gpa);
14711471
14721472 if (version < 5) {
lib/std/debug/Dwarf/expression.zig+1-1
......@@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type {
153153 }
154154 };
155155
156 stack: std.ArrayListUnmanaged(Value) = .{},
156 stack: std.ArrayListUnmanaged(Value) = .empty,
157157
158158 pub fn reset(self: *Self) void {
159159 self.stack.clearRetainingCapacity();
lib/std/debug/SelfInfo.zig+2-2
......@@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct {
19331933 len: u8 = 0,
19341934 };
19351935
1936 columns: std.ArrayListUnmanaged(Column) = .{},
1937 stack: std.ArrayListUnmanaged(ColumnRange) = .{},
1936 columns: std.ArrayListUnmanaged(Column) = .empty,
1937 stack: std.ArrayListUnmanaged(ColumnRange) = .empty,
19381938 current_row: Row = .{},
19391939
19401940 /// The result of executing the CIE's initial_instructions
lib/std/fs/Dir.zig+1-1
......@@ -750,7 +750,7 @@ pub const Walker = struct {
750750///
751751/// `self` will not be closed after walking it.
752752pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker {
753 var stack: std.ArrayListUnmanaged(Walker.StackItem) = .{};
753 var stack: std.ArrayListUnmanaged(Walker.StackItem) = .empty;
754754
755755 try stack.append(allocator, .{
756756 .iter = self.iterate(),
lib/std/fs/wasi.zig+1-1
......@@ -24,7 +24,7 @@ pub const Preopens = struct {
2424};
2525
2626pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens {
27 var names: std.ArrayListUnmanaged([]const u8) = .{};
27 var names: std.ArrayListUnmanaged([]const u8) = .empty;
2828 defer names.deinit(gpa);
2929
3030 try names.ensureUnusedCapacity(gpa, 3);
lib/std/hash/benchmark.zig+1-1
......@@ -410,7 +410,7 @@ pub fn main() !void {
410410 }
411411 }
412412
413 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
413 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
414414 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
415415 const allocator = gpa.allocator();
416416
lib/std/hash_map.zig+7-7
......@@ -401,7 +401,7 @@ pub fn HashMap(
401401 @compileError("Context must be specified! Call initContext(allocator, ctx) instead.");
402402 }
403403 return .{
404 .unmanaged = .{},
404 .unmanaged = .empty,
405405 .allocator = allocator,
406406 .ctx = undefined, // ctx is zero-sized so this is safe.
407407 };
......@@ -410,7 +410,7 @@ pub fn HashMap(
410410 /// Create a managed hash map with a context
411411 pub fn initContext(allocator: Allocator, ctx: Context) Self {
412412 return .{
413 .unmanaged = .{},
413 .unmanaged = .empty,
414414 .allocator = allocator,
415415 .ctx = ctx,
416416 };
......@@ -691,7 +691,7 @@ pub fn HashMap(
691691 pub fn move(self: *Self) Self {
692692 self.unmanaged.pointer_stability.assertUnlocked();
693693 const result = self.*;
694 self.unmanaged = .{};
694 self.unmanaged = .empty;
695695 return result;
696696 }
697697
......@@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged(
15431543 return self.cloneContext(allocator, @as(Context, undefined));
15441544 }
15451545 pub fn cloneContext(self: Self, allocator: Allocator, new_ctx: anytype) Allocator.Error!HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) {
1546 var other = HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage){};
1546 var other: HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) = .empty;
15471547 if (self.size == 0)
15481548 return other;
15491549
......@@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged(
15721572 pub fn move(self: *Self) Self {
15731573 self.pointer_stability.assertUnlocked();
15741574 const result = self.*;
1575 self.* = .{};
1575 self.* = .empty;
15761576 return result;
15771577 }
15781578
......@@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" {
23602360}
23612361
23622362test "repeat fetchRemove" {
2363 var map = AutoHashMapUnmanaged(u64, void){};
2363 var map: AutoHashMapUnmanaged(u64, void) = .empty;
23642364 defer map.deinit(testing.allocator);
23652365
23662366 try map.ensureTotalCapacity(testing.allocator, 4);
......@@ -2384,7 +2384,7 @@ test "repeat fetchRemove" {
23842384}
23852385
23862386test "getOrPut allocation failure" {
2387 var map: std.StringHashMapUnmanaged(void) = .{};
2387 var map: std.StringHashMapUnmanaged(void) = .empty;
23882388 try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello"));
23892389}
23902390
lib/std/json/hashmap.zig+3-3
......@@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value;
1212/// instead of comptime-known struct field names.
1313pub fn ArrayHashMap(comptime T: type) type {
1414 return struct {
15 map: std.StringArrayHashMapUnmanaged(T) = .{},
15 map: std.StringArrayHashMapUnmanaged(T) = .empty,
1616
1717 pub fn deinit(self: *@This(), allocator: Allocator) void {
1818 self.map.deinit(allocator);
1919 }
2020
2121 pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() {
22 var map = std.StringArrayHashMapUnmanaged(T){};
22 var map: std.StringArrayHashMapUnmanaged(T) = .empty;
2323 errdefer map.deinit(allocator);
2424
2525 if (.object_begin != try source.next()) return error.UnexpectedToken;
......@@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type {
5252 pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() {
5353 if (source != .object) return error.UnexpectedToken;
5454
55 var map = std.StringArrayHashMapUnmanaged(T){};
55 var map: std.StringArrayHashMapUnmanaged(T) = .empty;
5656 errdefer map.deinit(allocator);
5757
5858 var it = source.object.iterator();
lib/std/process/Child.zig+2-2
......@@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
907907 var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv);
908908 defer cmd_line_cache.deinit();
909909
910 var app_buf = std.ArrayListUnmanaged(u16){};
910 var app_buf: std.ArrayListUnmanaged(u16) = .empty;
911911 defer app_buf.deinit(self.allocator);
912912
913913 try app_buf.appendSlice(self.allocator, app_name_w);
914914
915 var dir_buf = std.ArrayListUnmanaged(u16){};
915 var dir_buf: std.ArrayListUnmanaged(u16) = .empty;
916916 defer dir_buf.deinit(self.allocator);
917917
918918 if (cwd_path_w.len > 0) {
lib/std/tar.zig+1-1
......@@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer;
2727/// the errors in diagnostics to know whether the operation succeeded or failed.
2828pub const Diagnostics = struct {
2929 allocator: std.mem.Allocator,
30 errors: std.ArrayListUnmanaged(Error) = .{},
30 errors: std.ArrayListUnmanaged(Error) = .empty,
3131
3232 entries: usize = 0,
3333 root_dir: []const u8 = "",
lib/std/testing.zig+2-2
......@@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll
1111
1212/// This should only be used in temporary test programs.
1313pub const allocator = allocator_instance.allocator();
14pub var allocator_instance = b: {
14pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{}) = b: {
1515 if (!builtin.is_test)
1616 @compileError("Cannot use testing allocator outside of test block");
17 break :b std.heap.GeneralPurposeAllocator(.{}){};
17 break :b .init;
1818};
1919
2020pub const failing_allocator = failing_allocator_instance.allocator();
lib/std/zig/AstGen.zig+20-20
......@@ -22,8 +22,8 @@ tree: *const Ast,
2222/// sub-expressions. See `AstRlAnnotate` for details.
2323nodes_need_rl: *const AstRlAnnotate.RlNeededSet,
2424instructions: std.MultiArrayList(Zir.Inst) = .{},
25extra: ArrayListUnmanaged(u32) = .{},
26string_bytes: ArrayListUnmanaged(u8) = .{},
25extra: ArrayListUnmanaged(u32) = .empty,
26string_bytes: ArrayListUnmanaged(u8) = .empty,
2727/// Tracks the current byte offset within the source file.
2828/// Used to populate line deltas in the ZIR. AstGen maintains
2929/// this "cursor" throughout the entire AST lowering process in order
......@@ -39,8 +39,8 @@ source_column: u32 = 0,
3939/// Used for temporary allocations; freed after AstGen is complete.
4040/// The resulting ZIR code has no references to anything in this arena.
4141arena: Allocator,
42string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{},
43compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .{},
42string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
43compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .empty,
4444/// The topmost block of the current function.
4545fn_block: ?*GenZir = null,
4646fn_var_args: bool = false,
......@@ -52,9 +52,9 @@ within_fn: bool = false,
5252fn_ret_ty: Zir.Inst.Ref = .none,
5353/// Maps string table indexes to the first `@import` ZIR instruction
5454/// that uses this string as the operand.
55imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{},
55imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty,
5656/// Used for temporary storage when building payloads.
57scratch: std.ArrayListUnmanaged(u32) = .{},
57scratch: std.ArrayListUnmanaged(u32) = .empty,
5858/// Whenever a `ref` instruction is needed, it is created and saved in this
5959/// table instead of being immediately appended to the current block body.
6060/// Then, when the instruction is being added to the parent block (typically from
......@@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{},
6565/// 2. `ref` instructions will dominate their uses. This is a required property
6666/// of ZIR.
6767/// The key is the ref operand; the value is the ref instruction.
68ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{},
68ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty,
6969/// Any information which should trigger invalidation of incremental compilation
7070/// data should be used to update this hasher. The result is the final source
7171/// hash of the enclosing declaration/etc.
......@@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
159159
160160 var top_scope: Scope.Top = .{};
161161
162 var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
162 var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
163163 var gen_scope: GenZir = .{
164164 .is_comptime = true,
165165 .parent = &top_scope.base,
......@@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi
58545854 const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len);
58555855 var fields_len: usize = 0;
58565856 {
5857 var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{};
5857 var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty;
58585858 defer idents.deinit(gpa);
58595859
58605860 const error_token = main_tokens[node];
......@@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co
1125911259 if (!mem.startsWith(u8, ident_name, "@")) {
1126011260 return ident_name;
1126111261 }
11262 var buf: ArrayListUnmanaged(u8) = .{};
11262 var buf: ArrayListUnmanaged(u8) = .empty;
1126311263 defer buf.deinit(astgen.gpa);
1126411264 try astgen.parseStrLit(token, &buf, ident_name, 1);
1126511265 if (mem.indexOfScalar(u8, buf.items, 0) != null) {
......@@ -11881,7 +11881,7 @@ const Scope = struct {
1188111881 parent: *Scope,
1188211882 /// Maps string table index to the source location of declaration,
1188311883 /// for the purposes of reporting name shadowing compile errors.
11884 decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .{},
11884 decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .empty,
1188511885 node: Ast.Node.Index,
1188611886 inst: Zir.Inst.Index,
1188711887 maybe_generic: bool,
......@@ -11891,7 +11891,7 @@ const Scope = struct {
1189111891 declaring_gz: ?*GenZir,
1189211892
1189311893 /// Set of captures used by this namespace.
11894 captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .{},
11894 captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .empty,
1189511895
1189611896 fn deinit(self: *Namespace, gpa: Allocator) void {
1189711897 self.decls.deinit(gpa);
......@@ -13607,9 +13607,9 @@ fn scanContainer(
1360713607 var sfba_state = std.heap.stackFallback(512, astgen.gpa);
1360813608 const sfba = sfba_state.get();
1360913609
13610 var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};
13611 var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};
13612 var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};
13610 var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
13611 var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
13612 var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
1361313613 defer {
1361413614 names.deinit(sfba);
1361513615 test_names.deinit(sfba);
......@@ -13796,7 +13796,7 @@ fn scanContainer(
1379613796
1379713797 for (names.keys(), names.values()) |name, first| {
1379813798 if (first.next == null) continue;
13799 var notes: std.ArrayListUnmanaged(u32) = .{};
13799 var notes: std.ArrayListUnmanaged(u32) = .empty;
1380013800 var prev: NameEntry = first;
1380113801 while (prev.next) |cur| : (prev = cur.*) {
1380213802 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{}));
......@@ -13808,7 +13808,7 @@ fn scanContainer(
1380813808
1380913809 for (test_names.keys(), test_names.values()) |name, first| {
1381013810 if (first.next == null) continue;
13811 var notes: std.ArrayListUnmanaged(u32) = .{};
13811 var notes: std.ArrayListUnmanaged(u32) = .empty;
1381213812 var prev: NameEntry = first;
1381313813 while (prev.next) |cur| : (prev = cur.*) {
1381413814 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{}));
......@@ -13820,7 +13820,7 @@ fn scanContainer(
1382013820
1382113821 for (decltest_names.keys(), decltest_names.values()) |name, first| {
1382213822 if (first.next == null) continue;
13823 var notes: std.ArrayListUnmanaged(u32) = .{};
13823 var notes: std.ArrayListUnmanaged(u32) = .empty;
1382413824 var prev: NameEntry = first;
1382513825 while (prev.next) |cur| : (prev = cur.*) {
1382613826 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{}));
......@@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void {
1394913949 const gpa = astgen.gpa;
1395013950 const parse_err = tree.errors[0];
1395113951
13952 var msg: std.ArrayListUnmanaged(u8) = .{};
13952 var msg: std.ArrayListUnmanaged(u8) = .empty;
1395313953 defer msg.deinit(gpa);
1395413954
13955 var notes: std.ArrayListUnmanaged(u32) = .{};
13955 var notes: std.ArrayListUnmanaged(u32) = .empty;
1395613956 defer notes.deinit(gpa);
1395713957
1395813958 for (tree.errors[1..]) |note| {
lib/std/zig/ErrorBundle.zig+1-1
......@@ -571,7 +571,7 @@ pub const Wip = struct {
571571 if (index == .none) return .none;
572572 const other_sl = other.getSourceLocation(index);
573573
574 var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .{};
574 var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .empty;
575575 defer ref_traces.deinit(wip.gpa);
576576
577577 if (other_sl.reference_trace_len > 0) {
lib/std/zig/WindowsSdk.zig+1-1
......@@ -751,7 +751,7 @@ const MsvcLibDir = struct {
751751 defer instances_dir.close();
752752
753753 var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined;
754 var latest_version_lib_dir = std.ArrayListUnmanaged(u8){};
754 var latest_version_lib_dir: std.ArrayListUnmanaged(u8) = .empty;
755755 errdefer latest_version_lib_dir.deinit(allocator);
756756
757757 var latest_version: u64 = 0;
lib/std/zig/Zir.zig+2-2
......@@ -3711,7 +3711,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In
37113711
37123712 // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse
37133713 // their contents once per defer. So, we store the extra index of the body here to deduplicate.
3714 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{};
3714 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
37153715 defer found_defers.deinit(gpa);
37163716
37173717 try zir.findDeclsBody(gpa, list, &found_defers, bodies.value_body);
......@@ -3725,7 +3725,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In
37253725pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void {
37263726 list.clearRetainingCapacity();
37273727
3728 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{};
3728 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
37293729 defer found_defers.deinit(gpa);
37303730
37313731 try zir.findDeclsInner(gpa, list, &found_defers, .main_struct_inst);
lib/std/zig/render.zig+7-7
......@@ -17,21 +17,21 @@ const Ais = AutoIndentingStream(std.ArrayList(u8).Writer);
1717pub const Fixups = struct {
1818 /// The key is the mut token (`var`/`const`) of the variable declaration
1919 /// that should have a `_ = foo;` inserted afterwards.
20 unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .{},
20 unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .empty,
2121 /// The functions in this unordered set of AST fn decl nodes will render
2222 /// with a function body of `@trap()` instead, with all parameters
2323 /// discarded.
24 gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{},
24 gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
2525 /// These global declarations will be omitted.
26 omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{},
26 omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
2727 /// These expressions will be replaced with the string value.
28 replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{},
28 replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty,
2929 /// The string value will be inserted directly after the node.
30 append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{},
30 append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty,
3131 /// These nodes will be replaced with a different node.
32 replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{},
32 replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty,
3333 /// Change all identifier names matching the key to be value instead.
34 rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .{},
34 rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .empty,
3535
3636 /// All `@import` builtin calls which refer to a file path will be prefixed
3737 /// with this path.
lib/std/zig/system/NativePaths.zig+5-5
......@@ -7,11 +7,11 @@ const mem = std.mem;
77const NativePaths = @This();
88
99arena: Allocator,
10include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
11lib_dirs: std.ArrayListUnmanaged([]const u8) = .{},
12framework_dirs: std.ArrayListUnmanaged([]const u8) = .{},
13rpaths: std.ArrayListUnmanaged([]const u8) = .{},
14warnings: std.ArrayListUnmanaged([]const u8) = .{},
10include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
11lib_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
12framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
13rpaths: std.ArrayListUnmanaged([]const u8) = .empty,
14warnings: std.ArrayListUnmanaged([]const u8) = .empty,
1515
1616pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths {
1717 var self: NativePaths = .{ .arena = arena };
src/Compilation.zig+23-23
......@@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8,
9595/// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE.
9696force_undefined_symbols: std.StringArrayHashMapUnmanaged(void),
9797
98c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{},
98c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty,
9999win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct {
100100 pub fn keys(_: @This()) [0]void {
101101 return .{};
......@@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa
106106 pub fn deinit(_: @This(), _: Allocator) void {}
107107} = .{},
108108
109link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{},
109link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .empty,
110110link_errors_mutex: std.Thread.Mutex = .{},
111111link_error_flags: link.File.ErrorFlags = .{},
112lld_errors: std.ArrayListUnmanaged(LldError) = .{},
112lld_errors: std.ArrayListUnmanaged(LldError) = .empty,
113113
114114work_queues: [
115115 len: {
......@@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic),
154154
155155/// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator.
156156/// This data is accessed by multiple threads and is protected by `mutex`.
157failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .{},
157failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty,
158158
159159/// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator.
160160/// This data is accessed by multiple threads and is protected by `mutex`.
......@@ -166,7 +166,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash
166166} = .{},
167167
168168/// Miscellaneous things that can fail.
169misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .{},
169misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty,
170170
171171/// When this is `true` it means invoking clang as a sub-process is expected to inherit
172172/// stdin, stdout, stderr, and if it returns non success, to forward the exit code.
......@@ -248,7 +248,7 @@ wasi_emulated_libs: []const wasi_libc.CRTFile,
248248/// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source,
249249/// The set of needed CRT (C runtime) files differs depending on the target and compilation settings.
250250/// The key is the basename, and the value is the absolute path to the completed build artifact.
251crt_files: std.StringHashMapUnmanaged(CRTFile) = .{},
251crt_files: std.StringHashMapUnmanaged(CRTFile) = .empty,
252252
253253/// How many lines of reference trace should be included per compile error.
254254/// Null means only show snippet on first error.
......@@ -527,8 +527,8 @@ pub const CObject = struct {
527527 }
528528
529529 pub const Bundle = struct {
530 file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{},
531 category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{},
530 file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty,
531 category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty,
532532 diags: []Diag = &.{},
533533
534534 pub fn destroy(bundle: *Bundle, gpa: Allocator) void {
......@@ -561,8 +561,8 @@ pub const CObject = struct {
561561 category: u32 = 0,
562562 msg: []const u8 = &.{},
563563 src_loc: SrcLoc = .{},
564 src_ranges: std.ArrayListUnmanaged(SrcRange) = .{},
565 sub_diags: std.ArrayListUnmanaged(Diag) = .{},
564 src_ranges: std.ArrayListUnmanaged(SrcRange) = .empty,
565 sub_diags: std.ArrayListUnmanaged(Diag) = .empty,
566566
567567 fn deinit(wip_diag: *@This(), allocator: Allocator) void {
568568 allocator.free(wip_diag.msg);
......@@ -580,19 +580,19 @@ pub const CObject = struct {
580580 var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() });
581581 defer bc.deinit();
582582
583 var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{};
583 var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty;
584584 errdefer {
585585 for (file_names.values()) |file_name| gpa.free(file_name);
586586 file_names.deinit(gpa);
587587 }
588588
589 var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{};
589 var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty;
590590 errdefer {
591591 for (category_names.values()) |category_name| gpa.free(category_name);
592592 category_names.deinit(gpa);
593593 }
594594
595 var stack: std.ArrayListUnmanaged(WipDiag) = .{};
595 var stack: std.ArrayListUnmanaged(WipDiag) = .empty;
596596 defer {
597597 for (stack.items) |*wip_diag| wip_diag.deinit(gpa);
598598 stack.deinit(gpa);
......@@ -1067,7 +1067,7 @@ pub const CreateOptions = struct {
10671067 cache_mode: CacheMode = .incremental,
10681068 lib_dirs: []const []const u8 = &[0][]const u8{},
10691069 rpath_list: []const []const u8 = &[0][]const u8{},
1070 symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{},
1070 symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty,
10711071 c_source_files: []const CSourceFile = &.{},
10721072 rc_source_files: []const RcSourceFile = &.{},
10731073 manifest_file: ?[]const u8 = null,
......@@ -1155,7 +1155,7 @@ pub const CreateOptions = struct {
11551155 skip_linker_dependencies: bool = false,
11561156 hash_style: link.File.Elf.HashStyle = .both,
11571157 entry: Entry = .default,
1158 force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{},
1158 force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty,
11591159 stack_size: ?u64 = null,
11601160 image_base: ?u64 = null,
11611161 version: ?std.SemanticVersion = null,
......@@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash(
12101210 main_mod: *Package.Module,
12111211 hash_type: union(enum) { path_bytes, files: *Cache.Manifest },
12121212) (error{OutOfMemory} || std.process.GetCwdError)!void {
1213 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{};
1213 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
12141214 defer seen_table.deinit(gpa);
12151215
12161216 // root_mod and main_mod may be the same pointer. In fact they usually are.
......@@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg(
33623362 const file_path = try err_src_loc.file_scope.fullPath(gpa);
33633363 defer gpa.free(file_path);
33643364
3365 var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .{};
3365 var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .empty;
33663366 defer ref_traces.deinit(gpa);
33673367
33683368 if (module_err_msg.reference_trace_root.unwrap()) |rt_root| {
......@@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg(
33703370 all_references.* = try mod.resolveReferences();
33713371 }
33723372
3373 var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .{};
3373 var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .empty;
33743374 defer seen.deinit(gpa);
33753375
33763376 const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len;
......@@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg(
34393439
34403440 // De-duplicate error notes. The main use case in mind for this is
34413441 // too many "note: called from here" notes when eval branch quota is reached.
3442 var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .{};
3442 var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty;
34433443 defer notes.deinit(gpa);
34443444
34453445 for (module_err_msg.notes) |module_note| {
......@@ -3544,7 +3544,7 @@ fn performAllTheWorkInner(
35443544 comp.job_queued_update_builtin_zig = false;
35453545 if (comp.zcu == null) break :b;
35463546 // TODO put all the modules in a flat array to make them easy to iterate.
3547 var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{};
3547 var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
35483548 defer seen.deinit(comp.gpa);
35493549 try seen.put(comp.gpa, comp.root_mod, {});
35503550 var i: usize = 0;
......@@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
40264026 };
40274027 defer tar_file.close();
40284028
4029 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .{};
4029 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty;
40304030 defer seen_table.deinit(comp.gpa);
40314031
40324032 try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name);
......@@ -5221,7 +5221,7 @@ fn spawnZigRc(
52215221 argv: []const []const u8,
52225222 child_progress_node: std.Progress.Node,
52235223) !void {
5224 var node_name: std.ArrayListUnmanaged(u8) = .{};
5224 var node_name: std.ArrayListUnmanaged(u8) = .empty;
52255225 defer node_name.deinit(arena);
52265226
52275227 var child = std.process.Child.init(argv, arena);
......@@ -5540,7 +5540,7 @@ pub fn addCCArgs(
55405540 }
55415541
55425542 {
5543 var san_arg: std.ArrayListUnmanaged(u8) = .{};
5543 var san_arg: std.ArrayListUnmanaged(u8) = .empty;
55445544 const prefix = "-fsanitize=";
55455545 if (mod.sanitize_c) {
55465546 if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix);
src/InternPool.zig+35-17
......@@ -2,20 +2,20 @@
22//! This data structure is self-contained.
33
44/// One item per thread, indexed by `tid`, which is dense and unique per thread.
5locals: []Local = &.{},
5locals: []Local,
66/// Length must be a power of two and represents the number of simultaneous
77/// writers that can mutate any single sharded data structure.
8shards: []Shard = &.{},
8shards: []Shard,
99/// Key is the error name, index is the error tag value. Index 0 has a length-0 string.
10global_error_set: GlobalErrorSet = GlobalErrorSet.empty,
10global_error_set: GlobalErrorSet,
1111/// Cached number of active bits in a `tid`.
12tid_width: if (single_threaded) u0 else std.math.Log2Int(u32) = 0,
12tid_width: if (single_threaded) u0 else std.math.Log2Int(u32),
1313/// Cached shift amount to put a `tid` in the top bits of a 30-bit value.
14tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,
14tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32),
1515/// Cached shift amount to put a `tid` in the top bits of a 31-bit value.
16tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,
16tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32),
1717/// Cached shift amount to put a `tid` in the top bits of a 32-bit value.
18tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,
18tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32),
1919
2020/// Dependencies on the source code hash associated with a ZIR instruction.
2121/// * For a `declaration`, this is the entire declaration body.
......@@ -23,36 +23,36 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_th
2323/// * For a `func`, this is the source of the full function signature.
2424/// These are also invalidated if tracking fails for this instruction.
2525/// Value is index into `dep_entries` of the first dependency on this hash.
26src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{},
26src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index),
2727/// Dependencies on the value of a Nav.
2828/// Value is index into `dep_entries` of the first dependency on this Nav value.
29nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .{},
29nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index),
3030/// Dependencies on an interned value, either:
3131/// * a runtime function (invalidated when its IES changes)
3232/// * a container type requiring resolution (invalidated when the type must be recreated at a new index)
3333/// Value is index into `dep_entries` of the first dependency on this interned value.
34interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .{},
34interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index),
3535/// Dependencies on the full set of names in a ZIR namespace.
3636/// Key refers to a `struct_decl`, `union_decl`, etc.
3737/// Value is index into `dep_entries` of the first dependency on this namespace.
38namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{},
38namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index),
3939/// Dependencies on the (non-)existence of some name in a namespace.
4040/// Value is index into `dep_entries` of the first dependency on this name.
41namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .{},
41namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index),
4242
4343/// Given a `Depender`, points to an entry in `dep_entries` whose `depender`
4444/// matches. The `next_dependee` field can be used to iterate all such entries
4545/// and remove them from the corresponding lists.
46first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .{},
46first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index),
4747
4848/// Stores dependency information. The hashmaps declared above are used to look
4949/// up entries in this list as required. This is not stored in `extra` so that
5050/// we can use `free_dep_entries` to track free indices, since dependencies are
5151/// removed frequently.
52dep_entries: std.ArrayListUnmanaged(DepEntry) = .{},
52dep_entries: std.ArrayListUnmanaged(DepEntry),
5353/// Stores unused indices in `dep_entries` which can be reused without a full
5454/// garbage collection pass.
55free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .{},
55free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index),
5656
5757/// Whether a multi-threaded intern pool is useful.
5858/// Currently `false` until the intern pool is actually accessed
......@@ -62,6 +62,24 @@ const want_multi_threaded = true;
6262/// Whether a single-threaded intern pool impl is in use.
6363pub const single_threaded = builtin.single_threaded or !want_multi_threaded;
6464
65pub const empty: InternPool = .{
66 .locals = &.{},
67 .shards = &.{},
68 .global_error_set = .empty,
69 .tid_width = 0,
70 .tid_shift_30 = if (single_threaded) 0 else 31,
71 .tid_shift_31 = if (single_threaded) 0 else 31,
72 .tid_shift_32 = if (single_threaded) 0 else 31,
73 .src_hash_deps = .empty,
74 .nav_val_deps = .empty,
75 .interned_deps = .empty,
76 .namespace_deps = .empty,
77 .namespace_name_deps = .empty,
78 .first_dependency = .empty,
79 .dep_entries = .empty,
80 .free_dep_entries = .empty,
81};
82
6583/// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole
6684/// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both
6785/// the file which the instruction lives in, and the instruction index itself, which is updated on
......@@ -9858,7 +9876,7 @@ fn extraData(extra: Local.Extra, comptime T: type, index: u32) T {
98589876test "basic usage" {
98599877 const gpa = std.testing.allocator;
98609878
9861 var ip: InternPool = .{};
9879 var ip: InternPool = .empty;
98629880 defer ip.deinit(gpa);
98639881
98649882 const i32_type = try ip.get(gpa, .main, .{ .int_type = .{
......@@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator)
1079110809 var bw = std.io.bufferedWriter(std.io.getStdErr().writer());
1079210810 const w = bw.writer();
1079310811
10794 var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .{};
10812 var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .empty;
1079510813 for (ip.locals, 0..) |*local, tid| {
1079610814 const items = local.shared.items.view().slice();
1079710815 const extra_list = local.shared.extra;
src/Liveness.zig+9-9
......@@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type {
9494 /// body and which we are currently within. Also includes `loop`s which are the target
9595 /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a
9696 /// `switch_dispatch` instruction.
97 breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},
97 breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
9898
9999 /// The set of operands for which we have seen at least one usage but not their birth.
100 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},
100 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
101101
102102 fn deinit(self: *@This(), gpa: Allocator) void {
103103 self.breaks.deinit(gpa);
......@@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type {
107107
108108 .main_analysis => struct {
109109 /// Every `block` and `loop` currently under analysis.
110 block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .{},
110 block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .empty,
111111
112112 /// The set of instructions currently alive in the current control
113113 /// flow branch.
114 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},
114 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
115115
116116 /// The extra data initialized by the `loop_analysis` pass for this pass to consume.
117117 /// Owned by this struct during this pass.
118 old_extra: std.ArrayListUnmanaged(u32) = .{},
118 old_extra: std.ArrayListUnmanaged(u32) = .empty,
119119
120120 const BlockScope = struct {
121121 /// If this is a `block`, these instructions are alive upon a `br` to this block.
......@@ -1710,10 +1710,10 @@ fn analyzeInstCondBr(
17101710 // Operands which are alive in one branch but not the other need to die at the start of
17111711 // the peer branch.
17121712
1713 var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{};
1713 var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty;
17141714 defer then_mirrored_deaths.deinit(gpa);
17151715
1716 var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{};
1716 var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty;
17171717 defer else_mirrored_deaths.deinit(gpa);
17181718
17191719 // Note: this invalidates `else_live`, but expands `then_live` to be their union
......@@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr(
17851785
17861786 switch (pass) {
17871787 .loop_analysis => {
1788 var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{};
1788 var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty;
17891789 defer old_breaks.deinit(gpa);
17901790
1791 var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{};
1791 var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty;
17921792 defer old_live.deinit(gpa);
17931793
17941794 if (is_dispatch_loop) {
src/Liveness/Verify.zig+2-2
......@@ -4,8 +4,8 @@ gpa: std.mem.Allocator,
44air: Air,
55liveness: Liveness,
66live: LiveMap = .{},
7blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{},
8loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{},
7blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty,
8loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty,
99intern_pool: *const InternPool,
1010
1111pub const Error = error{ LivenessInvalid, OutOfMemory };
src/Package/Fetch.zig+4-4
......@@ -91,7 +91,7 @@ pub const JobQueue = struct {
9191 /// `table` may be missing some tasks such as ones that failed, so this
9292 /// field contains references to all of them.
9393 /// Protected by `mutex`.
94 all_fetches: std.ArrayListUnmanaged(*Fetch) = .{},
94 all_fetches: std.ArrayListUnmanaged(*Fetch) = .empty,
9595
9696 http_client: *std.http.Client,
9797 thread_pool: *ThreadPool,
......@@ -1439,7 +1439,7 @@ fn computeHash(
14391439
14401440 // Track directories which had any files deleted from them so that empty directories
14411441 // can be deleted.
1442 var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{};
1442 var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty;
14431443 defer sus_dirs.deinit(gpa);
14441444
14451445 var walker = try root_dir.walk(gpa);
......@@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void {
17101710}
17111711
17121712const Filter = struct {
1713 include_paths: std.StringArrayHashMapUnmanaged(void) = .{},
1713 include_paths: std.StringArrayHashMapUnmanaged(void) = .empty,
17141714
17151715 /// sub_path is relative to the package root.
17161716 pub fn includePath(self: Filter, sub_path: []const u8) bool {
......@@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct {
23092309 var package_dir = try self.packageDir();
23102310 defer package_dir.close();
23112311
2312 var actual_files: std.ArrayListUnmanaged([]u8) = .{};
2312 var actual_files: std.ArrayListUnmanaged([]u8) = .empty;
23132313 defer actual_files.deinit(std.testing.allocator);
23142314 defer for (actual_files.items) |file| std.testing.allocator.free(file);
23152315 var walker = try package_dir.walk(std.testing.allocator);
src/Package/Fetch/git.zig+11-11
......@@ -38,7 +38,7 @@ test parseOid {
3838
3939pub const Diagnostics = struct {
4040 allocator: Allocator,
41 errors: std.ArrayListUnmanaged(Error) = .{},
41 errors: std.ArrayListUnmanaged(Error) = .empty,
4242
4343 pub const Error = union(enum) {
4444 unable_to_create_sym_link: struct {
......@@ -263,7 +263,7 @@ const Odb = struct {
263263 fn readObject(odb: *Odb) !Object {
264264 var base_offset = try odb.pack_file.getPos();
265265 var base_header: EntryHeader = undefined;
266 var delta_offsets = std.ArrayListUnmanaged(u64){};
266 var delta_offsets: std.ArrayListUnmanaged(u64) = .empty;
267267 defer delta_offsets.deinit(odb.allocator);
268268 const base_object = while (true) {
269269 if (odb.cache.get(base_offset)) |base_object| break base_object;
......@@ -361,7 +361,7 @@ const Object = struct {
361361/// freed by the caller at any point after inserting it into the cache. Any
362362/// objects remaining in the cache will be freed when the cache itself is freed.
363363const ObjectCache = struct {
364 objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .{},
364 objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .empty,
365365 lru_nodes: LruList = .{},
366366 byte_size: usize = 0,
367367
......@@ -660,7 +660,7 @@ pub const Session = struct {
660660 upload_pack_uri.query = null;
661661 upload_pack_uri.fragment = null;
662662
663 var body = std.ArrayListUnmanaged(u8){};
663 var body: std.ArrayListUnmanaged(u8) = .empty;
664664 defer body.deinit(allocator);
665665 const body_writer = body.writer(allocator);
666666 try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer);
......@@ -767,7 +767,7 @@ pub const Session = struct {
767767 upload_pack_uri.query = null;
768768 upload_pack_uri.fragment = null;
769769
770 var body = std.ArrayListUnmanaged(u8){};
770 var body: std.ArrayListUnmanaged(u8) = .empty;
771771 defer body.deinit(allocator);
772772 const body_writer = body.writer(allocator);
773773 try Packet.write(.{ .data = "command=fetch\n" }, body_writer);
......@@ -1044,9 +1044,9 @@ const IndexEntry = struct {
10441044pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void {
10451045 try pack.seekTo(0);
10461046
1047 var index_entries = std.AutoHashMapUnmanaged(Oid, IndexEntry){};
1047 var index_entries: std.AutoHashMapUnmanaged(Oid, IndexEntry) = .empty;
10481048 defer index_entries.deinit(allocator);
1049 var pending_deltas = std.ArrayListUnmanaged(IndexEntry){};
1049 var pending_deltas: std.ArrayListUnmanaged(IndexEntry) = .empty;
10501050 defer pending_deltas.deinit(allocator);
10511051
10521052 const pack_checksum = try indexPackFirstPass(allocator, pack, &index_entries, &pending_deltas);
......@@ -1068,7 +1068,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype)
10681068 remaining_deltas = pending_deltas.items.len;
10691069 }
10701070
1071 var oids = std.ArrayListUnmanaged(Oid){};
1071 var oids: std.ArrayListUnmanaged(Oid) = .empty;
10721072 defer oids.deinit(allocator);
10731073 try oids.ensureTotalCapacityPrecise(allocator, index_entries.count());
10741074 var index_entries_iter = index_entries.iterator();
......@@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype)
11091109 try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big);
11101110 }
11111111
1112 var big_offsets = std.ArrayListUnmanaged(u64){};
1112 var big_offsets: std.ArrayListUnmanaged(u64) = .empty;
11131113 defer big_offsets.deinit(allocator);
11141114 for (oids.items) |oid| {
11151115 const offset = index_entries.get(oid).?.offset;
......@@ -1213,7 +1213,7 @@ fn indexPackHashDelta(
12131213 // Figure out the chain of deltas to resolve
12141214 var base_offset = delta.offset;
12151215 var base_header: EntryHeader = undefined;
1216 var delta_offsets = std.ArrayListUnmanaged(u64){};
1216 var delta_offsets: std.ArrayListUnmanaged(u64) = .empty;
12171217 defer delta_offsets.deinit(allocator);
12181218 const base_object = while (true) {
12191219 if (cache.get(base_offset)) |base_object| break base_object;
......@@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" {
14471447 "file8",
14481448 "file9",
14491449 };
1450 var actual_files: std.ArrayListUnmanaged([]u8) = .{};
1450 var actual_files: std.ArrayListUnmanaged([]u8) = .empty;
14511451 defer actual_files.deinit(testing.allocator);
14521452 defer for (actual_files.items) |file| testing.allocator.free(file);
14531453 var walker = try worktree.dir.walk(testing.allocator);
src/Sema.zig+21-21
......@@ -13,7 +13,7 @@ gpa: Allocator,
1313arena: Allocator,
1414code: Zir,
1515air_instructions: std.MultiArrayList(Air.Inst) = .{},
16air_extra: std.ArrayListUnmanaged(u32) = .{},
16air_extra: std.ArrayListUnmanaged(u32) = .empty,
1717/// Maps ZIR to AIR.
1818inst_map: InstMap = .{},
1919/// The "owner" of a `Sema` represents the root "thing" that is being analyzed.
......@@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded,
6565/// They are created when an break_inline passes through a runtime condition, because
6666/// Sema must convert comptime control flow to runtime control flow, which means
6767/// breaking from a block.
68post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .{},
68post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .empty,
6969/// Populated with the last compile error created.
7070err: ?*Zcu.ErrorMsg = null,
7171/// Set to true when analyzing a func type instruction so that nested generic
......@@ -74,12 +74,12 @@ no_partial_func_ty: bool = false,
7474
7575/// The temporary arena is used for the memory of the `InferredAlloc` values
7676/// here so the values can be dropped without any cleanup.
77unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .{},
77unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty,
7878
7979/// Links every pointer derived from a base `alloc` back to that `alloc`. Used
8080/// to detect comptime-known `const`s.
8181/// TODO: ZIR liveness analysis would allow us to remove elements from this map.
82base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{},
82base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .empty,
8383
8484/// Runtime `alloc`s are placed in this map to track all comptime-known writes
8585/// before the corresponding `make_ptr_const` instruction.
......@@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{},
9090/// is comptime-known, and all stores to the pointer must be applied at comptime
9191/// to determine the comptime value.
9292/// Backed by gpa.
93maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .{},
93maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .empty,
9494
9595/// Comptime-mutable allocs, and any comptime allocs which reference it, are
9696/// stored as elements of this array.
9797/// Pointers to such memory are represented via an index into this array.
9898/// Backed by gpa.
99comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .{},
99comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .empty,
100100
101101/// A list of exports performed by this analysis. After this `Sema` terminates,
102102/// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`.
103exports: std.ArrayListUnmanaged(Zcu.Export) = .{},
103exports: std.ArrayListUnmanaged(Zcu.Export) = .empty,
104104
105105/// All references registered so far by this `Sema`. This is a temporary duplicate
106106/// of data stored in `Zcu.all_references`. It exists to avoid adding references to
107107/// a given `AnalUnit` multiple times.
108references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},
109type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{},
108references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
109type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty,
110110
111111/// All dependencies registered so far by this `Sema`. This is a temporary duplicate
112112/// of the main dependency data. It exists to avoid adding dependencies to a given
113113/// `AnalUnit` multiple times.
114dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{},
114dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty,
115115
116116/// Whether memoization of this call is permitted. Operations with side effects global
117117/// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed
......@@ -208,7 +208,7 @@ pub const InferredErrorSet = struct {
208208 /// are returned from any dependent functions.
209209 errors: NameMap = .{},
210210 /// Other inferred error sets which this inferred error set should include.
211 inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{},
211 inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty,
212212 /// The regular error set created by resolving this inferred error set.
213213 resolved: InternPool.Index = .none,
214214
......@@ -508,9 +508,9 @@ pub const Block = struct {
508508 /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions
509509 /// which correspond to `switch_continue` ZIR. The switch logic will
510510 /// rewrite these to appropriate AIR switch dispatches.
511 extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .{},
511 extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .empty,
512512 /// Same indexes, capacity, length as `extra_insts`.
513 extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .{},
513 extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .empty,
514514
515515 pub fn deinit(merges: *@This(), allocator: Allocator) void {
516516 merges.results.deinit(allocator);
......@@ -871,7 +871,7 @@ const InferredAlloc = struct {
871871 /// is known. These should be rewritten to perform any required coercions
872872 /// when the type is resolved.
873873 /// Allocated from `sema.arena`.
874 prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .{},
874 prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .empty,
875875};
876876
877877const NeededComptimeReason = struct {
......@@ -2908,7 +2908,7 @@ fn createTypeName(
29082908 const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail);
29092909 const zir_tags = sema.code.instructions.items(.tag);
29102910
2911 var buf: std.ArrayListUnmanaged(u8) = .{};
2911 var buf: std.ArrayListUnmanaged(u8) = .empty;
29122912 defer buf.deinit(gpa);
29132913
29142914 const writer = buf.writer(gpa);
......@@ -6851,11 +6851,11 @@ fn lookupInNamespace(
68516851
68526852 if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) {
68536853 const gpa = sema.gpa;
6854 var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{};
6854 var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .empty;
68556855 defer checked_namespaces.deinit(gpa);
68566856
68576857 // Keep track of name conflicts for error notes.
6858 var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{};
6858 var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty;
68596859 defer candidates.deinit(gpa);
68606860
68616861 try checked_namespaces.put(gpa, namespace, {});
......@@ -22754,7 +22754,7 @@ fn reifyUnion(
2275422754 break :tag_ty .{ enum_tag_ty.toIntern(), true };
2275522755 } else tag_ty: {
2275622756 // We must track field names and set up the tag type ourselves.
22757 var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};
22757 var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
2275822758 try field_names.ensureTotalCapacity(sema.arena, fields_len);
2275922759
2276022760 for (field_types, 0..) |*field_ty, field_idx| {
......@@ -37075,7 +37075,7 @@ fn unionFields(
3707537075
3707637076 var int_tag_ty: Type = undefined;
3707737077 var enum_field_names: []InternPool.NullTerminatedString = &.{};
37078 var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{};
37078 var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty;
3707937079 var explicit_tags_seen: []bool = &.{};
3708037080 if (tag_type_ref != .none) {
3708137081 const tag_ty_src: LazySrcLoc = .{
......@@ -37126,8 +37126,8 @@ fn unionFields(
3712637126 enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len);
3712737127 }
3712837128
37129 var field_types: std.ArrayListUnmanaged(InternPool.Index) = .{};
37130 var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .{};
37129 var field_types: std.ArrayListUnmanaged(InternPool.Index) = .empty;
37130 var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .empty;
3713137131
3713237132 try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len);
3713337133 if (small.any_aligned_fields)
src/Zcu.zig+45-45
......@@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory,
7676
7777/// This is where all `Export` values are stored. Not all values here are necessarily valid exports;
7878/// to enumerate all exports, `single_exports` and `multi_exports` must be consulted.
79all_exports: std.ArrayListUnmanaged(Export) = .{},
79all_exports: std.ArrayListUnmanaged(Export) = .empty,
8080/// This is a list of free indices in `all_exports`. These indices may be reused by exports from
8181/// future semantic analysis.
82free_exports: std.ArrayListUnmanaged(u32) = .{},
82free_exports: std.ArrayListUnmanaged(u32) = .empty,
8383/// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of
8484/// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit`
8585/// whose analysis triggered the export.
86single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},
86single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
8787/// Like `single_exports`, but for `AnalUnit`s which perform multiple exports.
8888/// The exports are `all_exports.items[index..][0..len]`.
8989multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
......@@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
104104/// `Compilation.update` of the process for a given `Compilation`.
105105///
106106/// Indexes correspond 1:1 to `files`.
107import_table: std.StringArrayHashMapUnmanaged(File.Index) = .{},
107import_table: std.StringArrayHashMapUnmanaged(File.Index) = .empty,
108108
109109/// The set of all the files which have been loaded with `@embedFile` in the Module.
110110/// We keep track of this in order to iterate over it and check which files have been
111111/// modified on the file system when an update is requested, as well as to cache
112112/// `@embedFile` results.
113113/// Keys are fully resolved file paths. This table owns the keys and values.
114embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .{},
114embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .empty,
115115
116116/// Stores all Type and Value objects.
117117/// The idea is that this will be periodically garbage-collected, but such logic
118118/// is not yet implemented.
119intern_pool: InternPool = .{},
119intern_pool: InternPool = .empty,
120120
121analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},
121analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
122122/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.
123failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .{},
123failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty,
124124/// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed.
125transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},
125transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
126126/// This `Nav` succeeded analysis, but failed codegen.
127127/// This may be a simple "value" `Nav`, or it may be a function.
128128/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.
129failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .{},
129failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty,
130130/// Keep track of one `@compileLog` callsite per `AnalUnit`.
131131/// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`.
132132compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
......@@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
141141}) = .{},
142142/// Using a map here for consistency with the other fields here.
143143/// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator.
144failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .{},
144failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .empty,
145145/// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator.
146failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .{},
146failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .empty,
147147/// Key is index into `all_exports`.
148failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .{},
148failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .empty,
149149/// If analysis failed due to a cimport error, the corresponding Clang errors
150150/// are stored here.
151cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .{},
151cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty,
152152
153153/// Maximum amount of distinct error values, set by --error-limit
154154error_limit: ErrorInt,
......@@ -156,19 +156,19 @@ error_limit: ErrorInt,
156156/// Value is the number of PO dependencies of this AnalUnit.
157157/// This value will decrease as we perform semantic analysis to learn what is outdated.
158158/// If any of these PO deps is outdated, this value will be moved to `outdated`.
159potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},
159potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
160160/// Value is the number of PO dependencies of this AnalUnit.
161161/// Once this value drops to 0, the AnalUnit is a candidate for re-analysis.
162outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},
162outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
163163/// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0.
164164/// Such `AnalUnit`s are ready for immediate re-analysis.
165165/// See `findOutdatedToAnalyze` for details.
166outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},
166outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
167167/// This contains a list of AnalUnit whose analysis or codegen failed, but the
168168/// failure was something like running out of disk space, and trying again may
169169/// succeed. On the next update, we will flush this list, marking all members of
170170/// it as outdated.
171retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .{},
171retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .empty,
172172
173173/// These are the modules which we initially queue for analysis in `Compilation.update`.
174174/// `resolveReferences` will use these as the root of its reachability traversal.
......@@ -184,31 +184,31 @@ stage1_flags: packed struct {
184184 reserved: u2 = 0,
185185} = .{},
186186
187compile_log_text: std.ArrayListUnmanaged(u8) = .{},
187compile_log_text: std.ArrayListUnmanaged(u8) = .empty,
188188
189test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .{},
189test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty,
190190
191global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .{},
191global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .empty,
192192
193193/// Key is the `AnalUnit` *performing* the reference. This representation allows
194194/// incremental updates to quickly delete references caused by a specific `AnalUnit`.
195195/// Value is index into `all_references` of the first reference triggered by the unit.
196196/// The `next` field on the `Reference` forms a linked list of all references
197197/// triggered by the key `AnalUnit`.
198reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},
199all_references: std.ArrayListUnmanaged(Reference) = .{},
198reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
199all_references: std.ArrayListUnmanaged(Reference) = .empty,
200200/// Freelist of indices in `all_references`.
201free_references: std.ArrayListUnmanaged(u32) = .{},
201free_references: std.ArrayListUnmanaged(u32) = .empty,
202202
203203/// Key is the `AnalUnit` *performing* the reference. This representation allows
204204/// incremental updates to quickly delete references caused by a specific `AnalUnit`.
205205/// Value is index into `all_type_reference` of the first reference triggered by the unit.
206206/// The `next` field on the `TypeReference` forms a linked list of all type references
207207/// triggered by the key `AnalUnit`.
208type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},
209all_type_references: std.ArrayListUnmanaged(TypeReference) = .{},
208type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
209all_type_references: std.ArrayListUnmanaged(TypeReference) = .empty,
210210/// Freelist of indices in `all_type_references`.
211free_type_references: std.ArrayListUnmanaged(u32) = .{},
211free_type_references: std.ArrayListUnmanaged(u32) = .empty,
212212
213213panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len,
214214/// The panic function body.
......@@ -338,16 +338,16 @@ pub const Namespace = struct {
338338 /// Will be a struct, enum, union, or opaque.
339339 owner_type: InternPool.Index,
340340 /// Members of the namespace which are marked `pub`.
341 pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{},
341 pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty,
342342 /// Members of the namespace which are *not* marked `pub`.
343 priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{},
343 priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty,
344344 /// All `usingnamespace` declarations in this namespace which are marked `pub`.
345 pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{},
345 pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty,
346346 /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`.
347 priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{},
347 priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty,
348348 /// All `comptime` and `test` declarations in this namespace. We store these purely so that
349349 /// incremental compilation can re-use the existing `Cau`s when a namespace changes.
350 other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .{},
350 other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .empty,
351351
352352 pub const Index = InternPool.NamespaceIndex;
353353 pub const OptionalIndex = InternPool.OptionalNamespaceIndex;
......@@ -451,7 +451,7 @@ pub const File = struct {
451451 /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen.
452452 multi_pkg: bool = false,
453453 /// List of references to this file, used for multi-package errors.
454 references: std.ArrayListUnmanaged(File.Reference) = .{},
454 references: std.ArrayListUnmanaged(File.Reference) = .empty,
455455
456456 /// The most recent successful ZIR for this file, with no errors.
457457 /// This is only populated when a previously successful ZIR
......@@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew(
25512551 old_inst: Zir.Inst.Index,
25522552 new_inst: Zir.Inst.Index,
25532553 };
2554 var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .{};
2554 var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .empty;
25552555 defer match_stack.deinit(gpa);
25562556
25572557 // Used as temporary buffers for namespace declaration instructions
2558 var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
2558 var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
25592559 defer old_decls.deinit(gpa);
2560 var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
2560 var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
25612561 defer new_decls.deinit(gpa);
25622562
25632563 // Map the main struct inst (and anything in its fields)
......@@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew(
25822582 try inst_map.put(gpa, match_item.old_inst, match_item.new_inst);
25832583
25842584 // Maps decl name to `declaration` instruction.
2585 var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{};
2585 var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty;
25862586 defer named_decls.deinit(gpa);
25872587 // Maps test name to `declaration` instruction.
2588 var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{};
2588 var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty;
25892589 defer named_tests.deinit(gpa);
25902590 // All unnamed tests, in order, for a best-effort match.
2591 var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
2591 var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
25922592 defer unnamed_tests.deinit(gpa);
25932593 // All comptime declarations, in order, for a best-effort match.
2594 var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
2594 var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
25952595 defer comptime_decls.deinit(gpa);
25962596 // All usingnamespace declarations, in order, for a best-effort match.
2597 var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};
2597 var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
25982598 defer usingnamespace_decls.deinit(gpa);
25992599
26002600 {
......@@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve
31543154 const comp = zcu.comp;
31553155 const ip = &zcu.intern_pool;
31563156
3157 var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{};
3157 var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty;
31583158 errdefer result.deinit(gpa);
31593159
3160 var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{};
3161 var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .{};
3162 var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{};
3160 var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty;
3161 var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty;
3162 var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty;
31633163 defer {
31643164 checked_types.deinit(gpa);
31653165 type_queue.deinit(gpa);
src/Zcu/PerThread.zig+6-6
......@@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {
320320 const gpa = zcu.gpa;
321321
322322 // We need to visit every updated File for every TrackedInst in InternPool.
323 var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .{};
323 var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .empty;
324324 defer cleanupUpdatedFiles(gpa, &updated_files);
325325 for (zcu.import_table.values()) |file_index| {
326326 const file = zcu.fileByIndex(file_index);
......@@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {
399399 };
400400 if (!has_namespace) continue;
401401
402 var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};
402 var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
403403 defer old_names.deinit(zcu.gpa);
404404 {
405405 var it = old_zir.declIterator(old_inst);
......@@ -1721,7 +1721,7 @@ pub fn scanNamespace(
17211721 // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather
17221722 // than their name. We'll build an efficient mapping now, then discard the current `decls`.
17231723 // We map to the `Cau`, since not every declaration has a `Nav`.
1724 var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .{};
1724 var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .empty;
17251725 defer existing_by_inst.deinit(gpa);
17261726
17271727 try existing_by_inst.ensureTotalCapacity(gpa, @intCast(
......@@ -1761,7 +1761,7 @@ pub fn scanNamespace(
17611761 }
17621762 }
17631763
1764 var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};
1764 var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
17651765 defer seen_decls.deinit(gpa);
17661766
17671767 namespace.pub_decls.clearRetainingCapacity();
......@@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void {
22932293 const gpa = zcu.gpa;
22942294
22952295 // First, construct a mapping of every exported value and Nav to the indices of all its different exports.
2296 var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .{};
2297 var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .{};
2296 var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .empty;
2297 var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .empty;
22982298 defer {
22992299 for (nav_exports.values()) |*exports| {
23002300 exports.deinit(gpa);
src/arch/aarch64/CodeGen.zig+6-6
......@@ -62,7 +62,7 @@ stack_align: u32,
6262/// MIR Instructions
6363mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
6464/// MIR extra data
65mir_extra: std.ArrayListUnmanaged(u32) = .{},
65mir_extra: std.ArrayListUnmanaged(u32) = .empty,
6666
6767/// Byte offset within the source file of the ending curly.
6868end_di_line: u32,
......@@ -71,13 +71,13 @@ end_di_column: u32,
7171/// The value is an offset into the `Function` `code` from the beginning.
7272/// To perform the reloc, write 32-bit signed little-endian integer
7373/// which is a relative jump, based on the address following the reloc.
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
7575
7676/// We postpone the creation of debug info for function args and locals
7777/// until after all Mir instructions have been generated. Only then we
7878/// will know saved_regs_stack_space which is necessary in order to
7979/// calculate the right stack offsest with respect to the `.fp` register.
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty,
8181
8282/// Whenever there is a runtime branch, we push a Branch onto this stack,
8383/// and pop it off when the runtime branch joins. This provides an "overlay"
......@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
8989branch_stack: *std.ArrayList(Branch),
9090
9191// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
9494register_manager: RegisterManager = .{},
9595/// Maps offset to what is stored there.
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
9797/// Tracks the current instruction allocated to the compare flags
9898compare_flags_inst: ?Air.Inst.Index = null,
9999
......@@ -247,7 +247,7 @@ const DbgInfoReloc = struct {
247247};
248248
249249const Branch = struct {
250 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},
250 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
251251
252252 fn deinit(self: *Branch, gpa: Allocator) void {
253253 self.inst_table.deinit(gpa);
src/arch/aarch64/Emit.zig+4-4
......@@ -33,18 +33,18 @@ prev_di_pc: usize,
3333saved_regs_stack_space: u32,
3434
3535/// The branch type of every branch
36branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},
36branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
3737
3838/// For every forward branch, maps the target instruction to a list of
3939/// branches which branch to this target instruction
40branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},
40branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
4141
4242/// For backward branches: stores the code offset of the target
4343/// instruction
4444///
4545/// For forward branches: stores the code offset of the branch
4646/// instruction
47code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},
47code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
4848
4949/// The final stack frame size of the function (already aligned to the
5050/// respective stack alignment). Does not include prologue stack space.
......@@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void {
346346 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
347347 try origin_list.append(gpa, inst);
348348 } else {
349 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};
349 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
350350 try origin_list.append(gpa, inst);
351351 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
352352 }
src/arch/arm/CodeGen.zig+6-6
......@@ -62,7 +62,7 @@ stack_align: u32,
6262/// MIR Instructions
6363mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
6464/// MIR extra data
65mir_extra: std.ArrayListUnmanaged(u32) = .{},
65mir_extra: std.ArrayListUnmanaged(u32) = .empty,
6666
6767/// Byte offset within the source file of the ending curly.
6868end_di_line: u32,
......@@ -71,13 +71,13 @@ end_di_column: u32,
7171/// The value is an offset into the `Function` `code` from the beginning.
7272/// To perform the reloc, write 32-bit signed little-endian integer
7373/// which is a relative jump, based on the address following the reloc.
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
7575
7676/// We postpone the creation of debug info for function args and locals
7777/// until after all Mir instructions have been generated. Only then we
7878/// will know saved_regs_stack_space which is necessary in order to
7979/// calculate the right stack offsest with respect to the `.fp` register.
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty,
8181
8282/// Whenever there is a runtime branch, we push a Branch onto this stack,
8383/// and pop it off when the runtime branch joins. This provides an "overlay"
......@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
8989branch_stack: *std.ArrayList(Branch),
9090
9191// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
9494register_manager: RegisterManager = .{},
9595/// Maps offset to what is stored there.
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
9797/// Tracks the current instruction allocated to the compare flags
9898cpsr_flags_inst: ?Air.Inst.Index = null,
9999
......@@ -168,7 +168,7 @@ const MCValue = union(enum) {
168168};
169169
170170const Branch = struct {
171 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},
171 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
172172
173173 fn deinit(self: *Branch, gpa: Allocator) void {
174174 self.inst_table.deinit(gpa);
src/arch/arm/Emit.zig+4-4
......@@ -40,16 +40,16 @@ saved_regs_stack_space: u32,
4040stack_size: u32,
4141
4242/// The branch type of every branch
43branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},
43branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
4444/// For every forward branch, maps the target instruction to a list of
4545/// branches which branch to this target instruction
46branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},
46branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
4747/// For backward branches: stores the code offset of the target
4848/// instruction
4949///
5050/// For forward branches: stores the code offset of the branch
5151/// instruction
52code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},
52code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
5353
5454const InnerError = error{
5555 OutOfMemory,
......@@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void {
264264 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
265265 try origin_list.append(gpa, inst);
266266 } else {
267 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};
267 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
268268 try origin_list.append(gpa, inst);
269269 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
270270 }
src/arch/riscv64/CodeGen.zig+7-7
......@@ -81,7 +81,7 @@ scope_generation: u32,
8181/// The value is an offset into the `Function` `code` from the beginning.
8282/// To perform the reloc, write 32-bit signed little-endian integer
8383/// which is a relative jump, based on the address following the reloc.
84exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
84exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
8585
8686/// Whenever there is a runtime branch, we push a Branch onto this stack,
8787/// and pop it off when the runtime branch joins. This provides an "overlay"
......@@ -97,14 +97,14 @@ avl: ?u64,
9797vtype: ?bits.VType,
9898
9999// Key is the block instruction
100blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
100blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
101101register_manager: RegisterManager = .{},
102102
103103const_tracking: ConstTrackingMap = .{},
104104inst_tracking: InstTrackingMap = .{},
105105
106106frame_allocs: std.MultiArrayList(FrameAlloc) = .{},
107free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{},
107free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty,
108108frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},
109109
110110loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {
......@@ -342,7 +342,7 @@ const MCValue = union(enum) {
342342};
343343
344344const Branch = struct {
345 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},
345 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
346346
347347 fn deinit(func: *Branch, gpa: Allocator) void {
348348 func.inst_table.deinit(gpa);
......@@ -621,7 +621,7 @@ const FrameAlloc = struct {
621621};
622622
623623const BlockData = struct {
624 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},
624 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
625625 state: State,
626626
627627 fn deinit(bd: *BlockData, gpa: Allocator) void {
......@@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
61936193
61946194 const Label = struct {
61956195 target: Mir.Inst.Index = undefined,
6196 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},
6196 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
61976197
61986198 const Kind = enum { definition, reference };
61996199
......@@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
62176217 return name.len > 0;
62186218 }
62196219 };
6220 var labels: std.StringHashMapUnmanaged(Label) = .{};
6220 var labels: std.StringHashMapUnmanaged(Label) = .empty;
62216221 defer {
62226222 var label_it = labels.valueIterator();
62236223 while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa);
src/arch/riscv64/Emit.zig+2-2
......@@ -10,8 +10,8 @@ prev_di_column: u32,
1010/// Relative to the beginning of `code`.
1111prev_di_pc: usize,
1212
13code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},
14relocs: std.ArrayListUnmanaged(Reloc) = .{},
13code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
14relocs: std.ArrayListUnmanaged(Reloc) = .empty,
1515
1616pub const Error = Lower.Error || error{
1717 EmitFail,
src/arch/sparc64/CodeGen.zig+5-5
......@@ -68,7 +68,7 @@ stack_align: Alignment,
6868/// MIR Instructions
6969mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
7070/// MIR extra data
71mir_extra: std.ArrayListUnmanaged(u32) = .{},
71mir_extra: std.ArrayListUnmanaged(u32) = .empty,
7272
7373/// Byte offset within the source file of the ending curly.
7474end_di_line: u32,
......@@ -77,7 +77,7 @@ end_di_column: u32,
7777/// The value is an offset into the `Function` `code` from the beginning.
7878/// To perform the reloc, write 32-bit signed little-endian integer
7979/// which is a relative jump, based on the address following the reloc.
80exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
80exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
8181
8282/// Whenever there is a runtime branch, we push a Branch onto this stack,
8383/// and pop it off when the runtime branch joins. This provides an "overlay"
......@@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
8989branch_stack: *std.ArrayList(Branch),
9090
9191// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
9494register_manager: RegisterManager = .{},
9595
9696/// Maps offset to what is stored there.
97stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},
97stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
9898
9999/// Tracks the current instruction allocated to the condition flags
100100condition_flags_inst: ?Air.Inst.Index = null,
......@@ -201,7 +201,7 @@ const MCValue = union(enum) {
201201};
202202
203203const Branch = struct {
204 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},
204 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
205205
206206 fn deinit(self: *Branch, gpa: Allocator) void {
207207 self.inst_table.deinit(gpa);
src/arch/sparc64/Emit.zig+4-4
......@@ -30,16 +30,16 @@ prev_di_column: u32,
3030prev_di_pc: usize,
3131
3232/// The branch type of every branch
33branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},
33branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
3434/// For every forward branch, maps the target instruction to a list of
3535/// branches which branch to this target instruction
36branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},
36branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
3737/// For backward branches: stores the code offset of the target
3838/// instruction
3939///
4040/// For forward branches: stores the code offset of the branch
4141/// instruction
42code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},
42code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
4343
4444const InnerError = error{
4545 OutOfMemory,
......@@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void {
571571 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
572572 try origin_list.append(gpa, inst);
573573 } else {
574 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};
574 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
575575 try origin_list.append(gpa, inst);
576576 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
577577 }
src/arch/wasm/CodeGen.zig+9-9
......@@ -654,7 +654,7 @@ func_index: InternPool.Index,
654654/// When we return from a branch, the branch will be popped from this list,
655655/// which means branches can only contain references from within its own branch,
656656/// or a branch higher (lower index) in the tree.
657branches: std.ArrayListUnmanaged(Branch) = .{},
657branches: std.ArrayListUnmanaged(Branch) = .empty,
658658/// Table to save `WValue`'s generated by an `Air.Inst`
659659// values: ValueTable,
660660/// Mapping from Air.Inst.Index to block ids
......@@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct {
663663 value: WValue,
664664}) = .{},
665665/// Maps `loop` instructions to their label. `br` to here repeats the loop.
666loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .{},
666loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty,
667667/// `bytes` contains the wasm bytecode belonging to the 'code' section.
668668code: *ArrayList(u8),
669669/// The index the next local generated will have
......@@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8),
681681/// List of simd128 immediates. Each value is stored as an array of bytes.
682682/// This list will only be populated for 128bit-simd values when the target features
683683/// are enabled also.
684simd_immediates: std.ArrayListUnmanaged([16]u8) = .{},
684simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty,
685685/// The Target we're emitting (used to call intInfo)
686686target: *const std.Target,
687687/// Represents the wasm binary file that is being linked.
......@@ -690,7 +690,7 @@ pt: Zcu.PerThread,
690690/// List of MIR Instructions
691691mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
692692/// Contains extra data for MIR
693mir_extra: std.ArrayListUnmanaged(u32) = .{},
693mir_extra: std.ArrayListUnmanaged(u32) = .empty,
694694/// When a function is executing, we store the the current stack pointer's value within this local.
695695/// This value is then used to restore the stack pointer to the original value at the return of the function.
696696initial_stack_value: WValue = .none,
......@@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16",
717717// allows us to re-use locals that are no longer used. e.g. a temporary local.
718718/// A list of indexes which represents a local of valtype `i32`.
719719/// It is illegal to store a non-i32 valtype in this list.
720free_locals_i32: std.ArrayListUnmanaged(u32) = .{},
720free_locals_i32: std.ArrayListUnmanaged(u32) = .empty,
721721/// A list of indexes which represents a local of valtype `i64`.
722722/// It is illegal to store a non-i64 valtype in this list.
723free_locals_i64: std.ArrayListUnmanaged(u32) = .{},
723free_locals_i64: std.ArrayListUnmanaged(u32) = .empty,
724724/// A list of indexes which represents a local of valtype `f32`.
725725/// It is illegal to store a non-f32 valtype in this list.
726free_locals_f32: std.ArrayListUnmanaged(u32) = .{},
726free_locals_f32: std.ArrayListUnmanaged(u32) = .empty,
727727/// A list of indexes which represents a local of valtype `f64`.
728728/// It is illegal to store a non-f64 valtype in this list.
729free_locals_f64: std.ArrayListUnmanaged(u32) = .{},
729free_locals_f64: std.ArrayListUnmanaged(u32) = .empty,
730730/// A list of indexes which represents a local of valtype `v127`.
731731/// It is illegal to store a non-v128 valtype in this list.
732free_locals_v128: std.ArrayListUnmanaged(u32) = .{},
732free_locals_v128: std.ArrayListUnmanaged(u32) = .empty,
733733
734734/// When in debug mode, this tracks if no `finishAir` was missed.
735735/// Forgetting to call `finishAir` will cause the result to not be
src/arch/x86_64/CodeGen.zig+7-7
......@@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null,
7878/// MIR Instructions
7979mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
8080/// MIR extra data
81mir_extra: std.ArrayListUnmanaged(u32) = .{},
81mir_extra: std.ArrayListUnmanaged(u32) = .empty,
8282
8383/// Byte offset within the source file of the ending curly.
8484end_di_line: u32,
......@@ -87,13 +87,13 @@ end_di_column: u32,
8787/// The value is an offset into the `Function` `code` from the beginning.
8888/// To perform the reloc, write 32-bit signed little-endian integer
8989/// which is a relative jump, based on the address following the reloc.
90exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},
90exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
9191
9292const_tracking: ConstTrackingMap = .{},
9393inst_tracking: InstTrackingMap = .{},
9494
9595// Key is the block instruction
96blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
96blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9797
9898register_manager: RegisterManager = .{},
9999
......@@ -101,7 +101,7 @@ register_manager: RegisterManager = .{},
101101scope_generation: u32 = 0,
102102
103103frame_allocs: std.MultiArrayList(FrameAlloc) = .{},
104free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{},
104free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty,
105105frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},
106106
107107loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {
......@@ -799,7 +799,7 @@ const StackAllocation = struct {
799799};
800800
801801const BlockData = struct {
802 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},
802 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
803803 state: State,
804804
805805 fn deinit(self: *BlockData, gpa: Allocator) void {
......@@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1424814248
1424914249 const Label = struct {
1425014250 target: Mir.Inst.Index = undefined,
14251 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},
14251 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
1425214252
1425314253 const Kind = enum { definition, reference };
1425414254
......@@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1427214272 return name.len > 0;
1427314273 }
1427414274 };
14275 var labels: std.StringHashMapUnmanaged(Label) = .{};
14275 var labels: std.StringHashMapUnmanaged(Label) = .empty;
1427614276 defer {
1427714277 var label_it = labels.valueIterator();
1427814278 while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa);
src/arch/x86_64/Emit.zig+2-2
......@@ -11,8 +11,8 @@ prev_di_column: u32,
1111/// Relative to the beginning of `code`.
1212prev_di_pc: usize,
1313
14code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},
15relocs: std.ArrayListUnmanaged(Reloc) = .{},
14code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
15relocs: std.ArrayListUnmanaged(Reloc) = .empty,
1616
1717pub const Error = Lower.Error || error{
1818 EmitFail,
src/codegen/c.zig+4-4
......@@ -304,14 +304,14 @@ pub const Function = struct {
304304 air: Air,
305305 liveness: Liveness,
306306 value_map: CValueMap,
307 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},
307 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
308308 next_arg_index: usize = 0,
309309 next_block_index: usize = 0,
310310 object: Object,
311311 lazy_fns: LazyFnMap,
312312 func_index: InternPool.Index,
313313 /// All the locals, to be emitted at the top of the function.
314 locals: std.ArrayListUnmanaged(Local) = .{},
314 locals: std.ArrayListUnmanaged(Local) = .empty,
315315 /// Which locals are available for reuse, based on Type.
316316 free_locals_map: LocalsMap = .{},
317317 /// Locals which will not be freed by Liveness. This is used after a
......@@ -320,10 +320,10 @@ pub const Function = struct {
320320 /// of variable declarations at the top of a function, sorted descending
321321 /// by type alignment.
322322 /// The value is whether the alloc needs to be emitted in the header.
323 allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{},
323 allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .empty,
324324 /// Maps from `loop_switch_br` instructions to the allocated local used
325325 /// for the switch cond. Dispatches should set this local to the new cond.
326 loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .{},
326 loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .empty,
327327
328328 fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue {
329329 const gop = try f.value_map.getOrPut(ref);
src/codegen/llvm.zig+9-9
......@@ -1500,7 +1500,7 @@ pub const Object = struct {
15001500 // instructions. Depending on the calling convention, this list is not necessarily
15011501 // a bijection with the actual LLVM parameters of the function.
15021502 const gpa = o.gpa;
1503 var args: std.ArrayListUnmanaged(Builder.Value) = .{};
1503 var args: std.ArrayListUnmanaged(Builder.Value) = .empty;
15041504 defer args.deinit(gpa);
15051505
15061506 {
......@@ -2497,7 +2497,7 @@ pub const Object = struct {
24972497
24982498 switch (ip.indexToKey(ty.toIntern())) {
24992499 .anon_struct_type => |tuple| {
2500 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};
2500 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
25012501 defer fields.deinit(gpa);
25022502
25032503 try fields.ensureUnusedCapacity(gpa, tuple.types.len);
......@@ -2574,7 +2574,7 @@ pub const Object = struct {
25742574
25752575 const struct_type = zcu.typeToStruct(ty).?;
25762576
2577 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};
2577 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
25782578 defer fields.deinit(gpa);
25792579
25802580 try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len);
......@@ -2667,7 +2667,7 @@ pub const Object = struct {
26672667 return debug_union_type;
26682668 }
26692669
2670 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};
2670 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
26712671 defer fields.deinit(gpa);
26722672
26732673 try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len);
......@@ -3412,7 +3412,7 @@ pub const Object = struct {
34123412 return int_ty;
34133413 }
34143414
3415 var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){};
3415 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty;
34163416 defer llvm_field_types.deinit(o.gpa);
34173417 // Although we can estimate how much capacity to add, these cannot be
34183418 // relied upon because of the recursive calls to lowerType below.
......@@ -3481,7 +3481,7 @@ pub const Object = struct {
34813481 return ty;
34823482 },
34833483 .anon_struct_type => |anon_struct_type| {
3484 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .{};
3484 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty;
34853485 defer llvm_field_types.deinit(o.gpa);
34863486 // Although we can estimate how much capacity to add, these cannot be
34873487 // relied upon because of the recursive calls to lowerType below.
......@@ -3672,7 +3672,7 @@ pub const Object = struct {
36723672 const target = zcu.getTarget();
36733673 const ret_ty = try lowerFnRetTy(o, fn_info);
36743674
3675 var llvm_params = std.ArrayListUnmanaged(Builder.Type){};
3675 var llvm_params: std.ArrayListUnmanaged(Builder.Type) = .empty;
36763676 defer llvm_params.deinit(o.gpa);
36773677
36783678 if (firstParamSRet(fn_info, zcu, target)) {
......@@ -7438,7 +7438,7 @@ pub const FuncGen = struct {
74387438 const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]);
74397439 extra_i += inputs.len;
74407440
7441 var llvm_constraints: std.ArrayListUnmanaged(u8) = .{};
7441 var llvm_constraints: std.ArrayListUnmanaged(u8) = .empty;
74427442 defer llvm_constraints.deinit(self.gpa);
74437443
74447444 var arena_allocator = std.heap.ArenaAllocator.init(self.gpa);
......@@ -7466,7 +7466,7 @@ pub const FuncGen = struct {
74667466 var llvm_param_i: usize = 0;
74677467 var total_i: u16 = 0;
74687468
7469 var name_map: std.StringArrayHashMapUnmanaged(u16) = .{};
7469 var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty;
74707470 try name_map.ensureUnusedCapacity(arena, max_param_count);
74717471
74727472 var rw_extra_i = extra_i;
src/codegen/llvm/Builder.zig+6-6
......@@ -3994,7 +3994,7 @@ pub const Function = struct {
39943994 names: [*]const String = &[0]String{},
39953995 value_indices: [*]const u32 = &[0]u32{},
39963996 strip: bool,
3997 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{},
3997 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty,
39983998 debug_values: []const Instruction.Index = &.{},
39993999 extra: []const u32 = &.{},
40004000
......@@ -6166,7 +6166,7 @@ pub const WipFunction = struct {
61666166 const value_indices = try gpa.alloc(u32, final_instructions_len);
61676167 errdefer gpa.free(value_indices);
61686168
6169 var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{};
6169 var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty;
61706170 errdefer debug_locations.deinit(gpa);
61716171 try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count()));
61726172
......@@ -9557,7 +9557,7 @@ pub fn printUnbuffered(
95579557 }
95589558 }
95599559
9560 var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .{};
9560 var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty;
95619561 defer attribute_groups.deinit(self.gpa);
95629562
95639563 for (0.., self.functions.items) |function_i, function| {
......@@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1313313133 // Write LLVM IR magic
1313413134 try bitcode.writeBits(ir.MAGIC, 32);
1313513135
13136 var record: std.ArrayListUnmanaged(u64) = .{};
13136 var record: std.ArrayListUnmanaged(u64) = .empty;
1313713137 defer record.deinit(self.gpa);
1313813138
1313913139 // IDENTIFICATION_BLOCK
......@@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1352413524 try paramattr_block.end();
1352513525 }
1352613526
13527 var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .{};
13527 var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty;
1352813528 defer globals.deinit(self.gpa);
1352913529 try globals.ensureUnusedCapacity(
1353013530 self.gpa,
......@@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1358713587
1358813588 // Globals
1358913589 {
13590 var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .{};
13590 var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty;
1359113591 defer section_map.deinit(self.gpa);
1359213592 try section_map.ensureUnusedCapacity(self.gpa, globals.count());
1359313593
src/codegen/spirv.zig+10-10
......@@ -79,7 +79,7 @@ const ControlFlow = union(enum) {
7979 selection: struct {
8080 /// In order to know which merges we still need to do, we need to keep
8181 /// a stack of those.
82 merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .{},
82 merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .empty,
8383 },
8484 /// For a `loop` type block, we can early-exit the block by
8585 /// jumping to the loop exit node, and we don't need to generate
......@@ -87,7 +87,7 @@ const ControlFlow = union(enum) {
8787 loop: struct {
8888 /// The next block to jump to can be determined from any number
8989 /// of conditions that jump to the loop exit.
90 merges: std.ArrayListUnmanaged(Incoming) = .{},
90 merges: std.ArrayListUnmanaged(Incoming) = .empty,
9191 /// The label id of the loop's merge block.
9292 merge_block: IdRef,
9393 },
......@@ -102,10 +102,10 @@ const ControlFlow = union(enum) {
102102 };
103103 /// The stack of (structured) blocks that we are currently in. This determines
104104 /// how exits from the current block must be handled.
105 block_stack: std.ArrayListUnmanaged(*Structured.Block) = .{},
105 block_stack: std.ArrayListUnmanaged(*Structured.Block) = .empty,
106106 /// Maps `block` inst indices to the variable that the block's result
107107 /// value must be written to.
108 block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .{},
108 block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .empty,
109109 };
110110
111111 const Unstructured = struct {
......@@ -116,12 +116,12 @@ const ControlFlow = union(enum) {
116116
117117 const Block = struct {
118118 label: ?IdRef = null,
119 incoming_blocks: std.ArrayListUnmanaged(Incoming) = .{},
119 incoming_blocks: std.ArrayListUnmanaged(Incoming) = .empty,
120120 };
121121
122122 /// We need to keep track of result ids for block labels, as well as the 'incoming'
123123 /// blocks for a block.
124 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .{},
124 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .empty,
125125 };
126126
127127 structured: Structured,
......@@ -153,10 +153,10 @@ pub const Object = struct {
153153
154154 /// The Zig module that this object file is generated for.
155155 /// A map of Zig decl indices to SPIR-V decl indices.
156 nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .{},
156 nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .empty,
157157
158158 /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices.
159 uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .{},
159 uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .empty,
160160
161161 /// A map that maps AIR intern pool indices to SPIR-V result-ids.
162162 intern_map: InternMap = .{},
......@@ -300,7 +300,7 @@ const NavGen = struct {
300300
301301 /// An array of function argument result-ids. Each index corresponds with the
302302 /// function argument of the same index.
303 args: std.ArrayListUnmanaged(IdRef) = .{},
303 args: std.ArrayListUnmanaged(IdRef) = .empty,
304304
305305 /// A counter to keep track of how many `arg` instructions we've seen yet.
306306 next_arg_index: u32 = 0,
......@@ -6270,7 +6270,7 @@ const NavGen = struct {
62706270 }
62716271 }
62726272
6273 var incoming_structured_blocks = std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming){};
6273 var incoming_structured_blocks: std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming) = .empty;
62746274 defer incoming_structured_blocks.deinit(self.gpa);
62756275
62766276 if (self.control_flow == .structured) {
src/codegen/spirv/Assembler.zig+5-5
......@@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue);
148148gpa: Allocator,
149149
150150/// A list of errors that occured during processing the assembly.
151errors: std.ArrayListUnmanaged(ErrorMsg) = .{},
151errors: std.ArrayListUnmanaged(ErrorMsg) = .empty,
152152
153153/// The source code that is being assembled.
154154src: []const u8,
......@@ -161,7 +161,7 @@ spv: *SpvModule,
161161func: *SpvModule.Fn,
162162
163163/// `self.src` tokenized.
164tokens: std.ArrayListUnmanaged(Token) = .{},
164tokens: std.ArrayListUnmanaged(Token) = .empty,
165165
166166/// The token that is next during parsing.
167167current_token: u32 = 0,
......@@ -172,9 +172,9 @@ inst: struct {
172172 /// The opcode of the current instruction.
173173 opcode: Opcode = undefined,
174174 /// Operands of the current instruction.
175 operands: std.ArrayListUnmanaged(Operand) = .{},
175 operands: std.ArrayListUnmanaged(Operand) = .empty,
176176 /// This is where string data resides. Strings are zero-terminated.
177 string_bytes: std.ArrayListUnmanaged(u8) = .{},
177 string_bytes: std.ArrayListUnmanaged(u8) = .empty,
178178
179179 /// Return a reference to the result of this instruction, if any.
180180 fn result(self: @This()) ?AsmValue.Ref {
......@@ -196,7 +196,7 @@ value_map: AsmValueMap = .{},
196196/// This set is used to quickly transform from an opcode name to the
197197/// index in its instruction set. The index of the key is the
198198/// index in `spec.InstructionSet.core.instructions()`.
199instruction_map: std.StringArrayHashMapUnmanaged(void) = .{},
199instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty,
200200
201201/// Free the resources owned by this assembler.
202202pub fn deinit(self: *Assembler) void {
src/codegen/spirv/Module.zig+10-10
......@@ -35,7 +35,7 @@ pub const Fn = struct {
3535 /// the end of this function definition.
3636 body: Section = .{},
3737 /// The decl dependencies that this function depends on.
38 decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{},
38 decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty,
3939
4040 /// Reset this function without deallocating resources, so that
4141 /// it may be used to emit code for another function.
......@@ -141,7 +141,7 @@ sections: struct {
141141next_result_id: Word,
142142
143143/// Cache for results of OpString instructions.
144strings: std.StringArrayHashMapUnmanaged(IdRef) = .{},
144strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty,
145145
146146/// Some types shouldn't be emitted more than one time, but cannot be caught by
147147/// the `intern_map` during codegen. Sometimes, IDs are compared to check if
......@@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{},
154154cache: struct {
155155 bool_type: ?IdRef = null,
156156 void_type: ?IdRef = null,
157 int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{},
158 float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{},
157 int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty,
158 float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty,
159159 // This cache is required so that @Vector(X, u1) in direct representation has the
160160 // same ID as @Vector(X, bool) in indirect representation.
161 vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .{},
161 vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .empty,
162162
163 builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{},
163 builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty,
164164} = .{},
165165
166166/// Set of Decls, referred to by Decl.Index.
167decls: std.ArrayListUnmanaged(Decl) = .{},
167decls: std.ArrayListUnmanaged(Decl) = .empty,
168168
169169/// List of dependencies, per decl. This list holds all the dependencies, sliced by the
170170/// begin_dep and end_dep in `self.decls`.
171decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{},
171decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty,
172172
173173/// The list of entry points that should be exported from this module.
174entry_points: std.ArrayListUnmanaged(EntryPoint) = .{},
174entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty,
175175
176176/// The list of extended instruction sets that should be imported.
177extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{},
177extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty,
178178
179179pub fn init(gpa: Allocator) Module {
180180 return .{
src/codegen/spirv/Section.zig+1-1
......@@ -15,7 +15,7 @@ const Opcode = spec.Opcode;
1515
1616/// The instructions in this section. Memory is owned by the Module
1717/// externally associated to this Section.
18instructions: std.ArrayListUnmanaged(Word) = .{},
18instructions: std.ArrayListUnmanaged(Word) = .empty,
1919
2020pub fn deinit(section: *Section, allocator: Allocator) void {
2121 section.instructions.deinit(allocator);
src/link/C.zig+15-15
......@@ -26,34 +26,34 @@ base: link.File,
2626/// This linker backend does not try to incrementally link output C source code.
2727/// Instead, it tracks all declarations in this table, and iterates over it
2828/// in the flush function, stitching pre-rendered pieces of C code together.
29navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .{},
29navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .empty,
3030/// All the string bytes of rendered C code, all squished into one array.
3131/// While in progress, a separate buffer is used, and then when finished, the
3232/// buffer is copied into this one.
33string_bytes: std.ArrayListUnmanaged(u8) = .{},
33string_bytes: std.ArrayListUnmanaged(u8) = .empty,
3434/// Tracks all the anonymous decls that are used by all the decls so they can
3535/// be rendered during flush().
36uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .{},
36uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .empty,
3737/// Sparse set of uavs that are overaligned. Underaligned anon decls are
3838/// lowered the same as ABI-aligned anon decls. The keys here are a subset of
3939/// the keys of `uavs`.
40aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .{},
40aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty,
4141
42exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .{},
43exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .{},
42exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .empty,
43exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .empty,
4444
4545/// Optimization, `updateDecl` reuses this buffer rather than creating a new
4646/// one with every call.
47fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{},
47fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty,
4848/// Optimization, `updateDecl` reuses this buffer rather than creating a new
4949/// one with every call.
50code_buf: std.ArrayListUnmanaged(u8) = .{},
50code_buf: std.ArrayListUnmanaged(u8) = .empty,
5151/// Optimization, `flush` reuses this buffer rather than creating a new
5252/// one with every call.
53lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{},
53lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty,
5454/// Optimization, `flush` reuses this buffer rather than creating a new
5555/// one with every call.
56lazy_code_buf: std.ArrayListUnmanaged(u8) = .{},
56lazy_code_buf: std.ArrayListUnmanaged(u8) = .empty,
5757
5858/// A reference into `string_bytes`.
5959const String = extern struct {
......@@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
469469 // `CType`s, forward decls, and non-functions first.
470470
471471 {
472 var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};
472 var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
473473 defer export_names.deinit(gpa);
474474 try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count()));
475475 for (zcu.single_exports.values()) |export_index| {
......@@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
559559
560560const Flush = struct {
561561 ctype_pool: codegen.CType.Pool,
562 ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .{},
563 ctypes_buf: std.ArrayListUnmanaged(u8) = .{},
562 ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .empty,
563 ctypes_buf: std.ArrayListUnmanaged(u8) = .empty,
564564
565565 lazy_ctype_pool: codegen.CType.Pool,
566566 lazy_fns: LazyFns = .{},
567567
568 asm_buf: std.ArrayListUnmanaged(u8) = .{},
568 asm_buf: std.ArrayListUnmanaged(u8) = .empty,
569569
570570 /// We collect a list of buffers to write, and write them all at once with pwritev 😎
571 all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .{},
571 all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .empty,
572572 /// Keeps track of the total bytes of `all_buffers`.
573573 file_size: u64 = 0,
574574
src/link/Coff.zig+13-13
......@@ -26,7 +26,7 @@ repro: bool,
2626ptr_width: PtrWidth,
2727page_size: u32,
2828
29objects: std.ArrayListUnmanaged(Object) = .{},
29objects: std.ArrayListUnmanaged(Object) = .empty,
3030
3131sections: std.MultiArrayList(Section) = .{},
3232data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory,
......@@ -38,14 +38,14 @@ data_section_index: ?u16 = null,
3838reloc_section_index: ?u16 = null,
3939idata_section_index: ?u16 = null,
4040
41locals: std.ArrayListUnmanaged(coff.Symbol) = .{},
42globals: std.ArrayListUnmanaged(SymbolWithLoc) = .{},
43resolver: std.StringHashMapUnmanaged(u32) = .{},
44unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .{},
45need_got_table: std.AutoHashMapUnmanaged(u32, void) = .{},
41locals: std.ArrayListUnmanaged(coff.Symbol) = .empty,
42globals: std.ArrayListUnmanaged(SymbolWithLoc) = .empty,
43resolver: std.StringHashMapUnmanaged(u32) = .empty,
44unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .empty,
45need_got_table: std.AutoHashMapUnmanaged(u32, void) = .empty,
4646
47locals_free_list: std.ArrayListUnmanaged(u32) = .{},
48globals_free_list: std.ArrayListUnmanaged(u32) = .{},
47locals_free_list: std.ArrayListUnmanaged(u32) = .empty,
48globals_free_list: std.ArrayListUnmanaged(u32) = .empty,
4949
5050strtab: StringTable = .{},
5151strtab_offset: ?u32 = null,
......@@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{},
5656
5757/// A table of ImportTables partitioned by the library name.
5858/// Key is an offset into the interning string table `temp_strtab`.
59import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .{},
59import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .empty,
6060
6161got_table_count_dirty: bool = true,
6262got_table_contents_dirty: bool = true,
......@@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{},
6969navs: NavTable = .{},
7070
7171/// List of atoms that are either synthetic or map directly to the Zig source program.
72atoms: std.ArrayListUnmanaged(Atom) = .{},
72atoms: std.ArrayListUnmanaged(Atom) = .empty,
7373
7474/// Table of atoms indexed by the symbol index.
75atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{},
75atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty,
7676
7777uavs: UavTable = .{},
7878
......@@ -131,7 +131,7 @@ const Section = struct {
131131 /// overcapacity can be negative. A simple way to have negative overcapacity is to
132132 /// allocate a fresh atom, which will have ideal capacity, and then grow it
133133 /// by 1 byte. It will then have -1 overcapacity.
134 free_list: std.ArrayListUnmanaged(Atom.Index) = .{},
134 free_list: std.ArrayListUnmanaged(Atom.Index) = .empty,
135135};
136136
137137const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata);
......@@ -148,7 +148,7 @@ const AvMetadata = struct {
148148 atom: Atom.Index,
149149 section: u16,
150150 /// A list of all exports aliases of this Decl.
151 exports: std.ArrayListUnmanaged(u32) = .{},
151 exports: std.ArrayListUnmanaged(u32) = .empty,
152152
153153 fn deinit(m: *AvMetadata, allocator: Allocator) void {
154154 m.exports.deinit(allocator);
src/link/Coff/ImportTable.zig+3-3
......@@ -26,9 +26,9 @@
2626//! DLL#2 name
2727//! --- END
2828
29entries: std.ArrayListUnmanaged(SymbolWithLoc) = .{},
30free_list: std.ArrayListUnmanaged(u32) = .{},
31lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .{},
29entries: std.ArrayListUnmanaged(SymbolWithLoc) = .empty,
30free_list: std.ArrayListUnmanaged(u32) = .empty,
31lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .empty,
3232
3333pub fn deinit(itab: *ImportTable, allocator: Allocator) void {
3434 itab.entries.deinit(allocator);
src/link/Elf.zig+19-19
......@@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{},
3939/// Long-lived list of all file descriptors.
4040/// We store them globally rather than per actual File so that we can re-use
4141/// one file handle per every object file within an archive.
42file_handles: std.ArrayListUnmanaged(File.Handle) = .{},
42file_handles: std.ArrayListUnmanaged(File.Handle) = .empty,
4343zig_object_index: ?File.Index = null,
4444linker_defined_index: ?File.Index = null,
45objects: std.ArrayListUnmanaged(File.Index) = .{},
46shared_objects: std.ArrayListUnmanaged(File.Index) = .{},
45objects: std.ArrayListUnmanaged(File.Index) = .empty,
46shared_objects: std.ArrayListUnmanaged(File.Index) = .empty,
4747
4848/// List of all output sections and their associated metadata.
4949sections: std.MultiArrayList(Section) = .{},
......@@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null,
5252
5353/// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write.
5454/// Same order as in the file.
55phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .{},
55phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .empty,
5656
5757/// Special program headers
5858/// PT_PHDR
......@@ -77,23 +77,23 @@ page_size: u32,
7777default_sym_version: elf.Elf64_Versym,
7878
7979/// .shstrtab buffer
80shstrtab: std.ArrayListUnmanaged(u8) = .{},
80shstrtab: std.ArrayListUnmanaged(u8) = .empty,
8181/// .symtab buffer
82symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},
82symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
8383/// .strtab buffer
84strtab: std.ArrayListUnmanaged(u8) = .{},
84strtab: std.ArrayListUnmanaged(u8) = .empty,
8585/// Dynamic symbol table. Only populated and emitted when linking dynamically.
8686dynsym: DynsymSection = .{},
8787/// .dynstrtab buffer
88dynstrtab: std.ArrayListUnmanaged(u8) = .{},
88dynstrtab: std.ArrayListUnmanaged(u8) = .empty,
8989/// Version symbol table. Only populated and emitted when linking dynamically.
90versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{},
90versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty,
9191/// .verneed section
9292verneed: VerneedSection = .{},
9393/// .got section
9494got: GotSection = .{},
9595/// .rela.dyn section
96rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},
96rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
9797/// .dynamic section
9898dynamic: DynamicSection = .{},
9999/// .hash section
......@@ -109,10 +109,10 @@ plt_got: PltGotSection = .{},
109109/// .copyrel section
110110copy_rel: CopyRelSection = .{},
111111/// .rela.plt section
112rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},
112rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
113113/// SHT_GROUP sections
114114/// Applies only to a relocatable.
115comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .{},
115comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .empty,
116116
117117copy_rel_section_index: ?u32 = null,
118118dynamic_section_index: ?u32 = null,
......@@ -143,10 +143,10 @@ has_text_reloc: bool = false,
143143num_ifunc_dynrelocs: usize = 0,
144144
145145/// List of range extension thunks.
146thunks: std.ArrayListUnmanaged(Thunk) = .{},
146thunks: std.ArrayListUnmanaged(Thunk) = .empty,
147147
148148/// List of output merge sections with deduped contents.
149merge_sections: std.ArrayListUnmanaged(MergeSection) = .{},
149merge_sections: std.ArrayListUnmanaged(MergeSection) = .empty,
150150
151151first_eflags: ?elf.Elf64_Word = null,
152152
......@@ -5487,9 +5487,9 @@ pub const Ref = struct {
54875487};
54885488
54895489pub const SymbolResolver = struct {
5490 keys: std.ArrayListUnmanaged(Key) = .{},
5491 values: std.ArrayListUnmanaged(Ref) = .{},
5492 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},
5490 keys: std.ArrayListUnmanaged(Key) = .empty,
5491 values: std.ArrayListUnmanaged(Ref) = .empty,
5492 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
54935493
54945494 const Result = struct {
54955495 found_existing: bool,
......@@ -5586,7 +5586,7 @@ const Section = struct {
55865586 /// List of atoms contributing to this section.
55875587 /// TODO currently this is only used for relocations tracking in relocatable mode
55885588 /// but will be merged with atom_list_2.
5589 atom_list: std.ArrayListUnmanaged(Ref) = .{},
5589 atom_list: std.ArrayListUnmanaged(Ref) = .empty,
55905590
55915591 /// List of atoms contributing to this section.
55925592 /// This can be used by sections that require special handling such as init/fini array, etc.
......@@ -5610,7 +5610,7 @@ const Section = struct {
56105610 /// overcapacity can be negative. A simple way to have negative overcapacity is to
56115611 /// allocate a fresh text block, which will have ideal capacity, and then grow it
56125612 /// by 1 byte. It will then have -1 overcapacity.
5613 free_list: std.ArrayListUnmanaged(Ref) = .{},
5613 free_list: std.ArrayListUnmanaged(Ref) = .empty,
56145614};
56155615
56165616fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 {
src/link/Elf/Archive.zig+4-4
......@@ -1,5 +1,5 @@
1objects: std.ArrayListUnmanaged(Object) = .{},
2strtab: std.ArrayListUnmanaged(u8) = .{},
1objects: std.ArrayListUnmanaged(Object) = .empty,
2strtab: std.ArrayListUnmanaged(u8) = .empty,
33
44pub fn isArchive(path: []const u8) !bool {
55 const file = try std.fs.cwd().openFile(path, .{});
......@@ -127,7 +127,7 @@ const strtab_delimiter = '\n';
127127pub const max_member_name_len = 15;
128128
129129pub const ArSymtab = struct {
130 symtab: std.ArrayListUnmanaged(Entry) = .{},
130 symtab: std.ArrayListUnmanaged(Entry) = .empty,
131131 strtab: StringTable = .{},
132132
133133 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {
......@@ -241,7 +241,7 @@ pub const ArSymtab = struct {
241241};
242242
243243pub const ArStrtab = struct {
244 buffer: std.ArrayListUnmanaged(u8) = .{},
244 buffer: std.ArrayListUnmanaged(u8) = .empty,
245245
246246 pub fn deinit(ar: *ArStrtab, allocator: Allocator) void {
247247 ar.buffer.deinit(allocator);
src/link/Elf/AtomList.zig+1-1
......@@ -2,7 +2,7 @@ value: i64 = 0,
22size: u64 = 0,
33alignment: Atom.Alignment = .@"1",
44output_section_index: u32 = 0,
5atoms: std.ArrayListUnmanaged(Elf.Ref) = .{},
5atoms: std.ArrayListUnmanaged(Elf.Ref) = .empty,
66
77pub fn deinit(list: *AtomList, allocator: Allocator) void {
88 list.atoms.deinit(allocator);
src/link/Elf/LdScript.zig+1-1
......@@ -1,6 +1,6 @@
11path: []const u8,
22cpu_arch: ?std.Target.Cpu.Arch = null,
3args: std.ArrayListUnmanaged(Elf.SystemLib) = .{},
3args: std.ArrayListUnmanaged(Elf.SystemLib) = .empty,
44
55pub fn deinit(scr: *LdScript, allocator: Allocator) void {
66 scr.args.deinit(allocator);
src/link/Elf/LinkerDefined.zig+6-6
......@@ -1,11 +1,11 @@
11index: File.Index,
22
3symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},
4strtab: std.ArrayListUnmanaged(u8) = .{},
3symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
4strtab: std.ArrayListUnmanaged(u8) = .empty,
55
6symbols: std.ArrayListUnmanaged(Symbol) = .{},
7symbols_extra: std.ArrayListUnmanaged(u32) = .{},
8symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},
6symbols: std.ArrayListUnmanaged(Symbol) = .empty,
7symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
8symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
99
1010entry_index: ?Symbol.Index = null,
1111dynamic_index: ?Symbol.Index = null,
......@@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null,
2424rela_iplt_start_index: ?Symbol.Index = null,
2525rela_iplt_end_index: ?Symbol.Index = null,
2626global_pointer_index: ?Symbol.Index = null,
27start_stop_indexes: std.ArrayListUnmanaged(u32) = .{},
27start_stop_indexes: std.ArrayListUnmanaged(u32) = .empty,
2828
2929output_symtab_ctx: Elf.SymtabCtx = .{},
3030
src/link/Elf/Object.zig+17-17
......@@ -4,29 +4,29 @@ file_handle: File.HandleIndex,
44index: File.Index,
55
66header: ?elf.Elf64_Ehdr = null,
7shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{},
7shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty,
88
9symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},
10strtab: std.ArrayListUnmanaged(u8) = .{},
9symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
10strtab: std.ArrayListUnmanaged(u8) = .empty,
1111first_global: ?Symbol.Index = null,
12symbols: std.ArrayListUnmanaged(Symbol) = .{},
13symbols_extra: std.ArrayListUnmanaged(u32) = .{},
14symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},
15relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},
12symbols: std.ArrayListUnmanaged(Symbol) = .empty,
13symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
14symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
15relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
1616
17atoms: std.ArrayListUnmanaged(Atom) = .{},
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},
19atoms_extra: std.ArrayListUnmanaged(u32) = .{},
17atoms: std.ArrayListUnmanaged(Atom) = .empty,
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
19atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
2020
21comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .{},
22comdat_group_data: std.ArrayListUnmanaged(u32) = .{},
21comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .empty,
22comdat_group_data: std.ArrayListUnmanaged(u32) = .empty,
2323
24input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .{},
25input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .{},
24input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .empty,
25input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .empty,
2626
27fdes: std.ArrayListUnmanaged(Fde) = .{},
28cies: std.ArrayListUnmanaged(Cie) = .{},
29eh_frame_data: std.ArrayListUnmanaged(u8) = .{},
27fdes: std.ArrayListUnmanaged(Fde) = .empty,
28cies: std.ArrayListUnmanaged(Cie) = .empty,
29eh_frame_data: std.ArrayListUnmanaged(u8) = .empty,
3030
3131alive: bool = true,
3232num_dynrelocs: u32 = 0,
src/link/Elf/SharedObject.zig+9-9
......@@ -2,20 +2,20 @@ path: []const u8,
22index: File.Index,
33
44header: ?elf.Elf64_Ehdr = null,
5shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{},
5shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty,
66
7symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},
8strtab: std.ArrayListUnmanaged(u8) = .{},
7symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
8strtab: std.ArrayListUnmanaged(u8) = .empty,
99/// Version symtab contains version strings of the symbols if present.
10versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{},
11verstrings: std.ArrayListUnmanaged(u32) = .{},
10versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty,
11verstrings: std.ArrayListUnmanaged(u32) = .empty,
1212
13symbols: std.ArrayListUnmanaged(Symbol) = .{},
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},
13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
1616
1717aliases: ?std.ArrayListUnmanaged(u32) = null,
18dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{},
18dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty,
1919
2020needed: bool,
2121alive: bool,
src/link/Elf/Thunk.zig+1-1
......@@ -1,6 +1,6 @@
11value: i64 = 0,
22output_section_index: u32 = 0,
3symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{},
3symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty,
44output_symtab_ctx: Elf.SymtabCtx = .{},
55
66pub fn deinit(thunk: *Thunk, allocator: Allocator) void {
src/link/Elf/ZigObject.zig+13-13
......@@ -3,24 +3,24 @@
33//! and any relocations that may have been emitted.
44//! Think about this as fake in-memory Object file for the Zig module.
55
6data: std.ArrayListUnmanaged(u8) = .{},
6data: std.ArrayListUnmanaged(u8) = .empty,
77/// Externally owned memory.
88path: []const u8,
99index: File.Index,
1010
1111symtab: std.MultiArrayList(ElfSym) = .{},
1212strtab: StringTable = .{},
13symbols: std.ArrayListUnmanaged(Symbol) = .{},
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},
16local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},
17global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},
18globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{},
19
20atoms: std.ArrayListUnmanaged(Atom) = .{},
21atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},
22atoms_extra: std.ArrayListUnmanaged(u32) = .{},
23relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .{},
13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
16local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
17global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
18globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty,
19
20atoms: std.ArrayListUnmanaged(Atom) = .empty,
21atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
22atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
23relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .empty,
2424
2525num_dynrelocs: u32 = 0,
2626
......@@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct {
23132313const AvMetadata = struct {
23142314 symbol_index: Symbol.Index,
23152315 /// A list of all exports aliases of this Av.
2316 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},
2316 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
23172317 /// Set to true if the AV has been initialized and allocated.
23182318 allocated: bool = false,
23192319
src/link/Elf/merge_section.zig+7-7
......@@ -7,15 +7,15 @@ pub const MergeSection = struct {
77 type: u32 = 0,
88 flags: u64 = 0,
99 output_section_index: u32 = 0,
10 bytes: std.ArrayListUnmanaged(u8) = .{},
10 bytes: std.ArrayListUnmanaged(u8) = .empty,
1111 table: std.HashMapUnmanaged(
1212 String,
1313 MergeSubsection.Index,
1414 IndexContext,
1515 std.hash_map.default_max_load_percentage,
1616 ) = .{},
17 subsections: std.ArrayListUnmanaged(MergeSubsection) = .{},
18 finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{},
17 subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty,
18 finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty,
1919
2020 pub fn deinit(msec: *MergeSection, allocator: Allocator) void {
2121 msec.bytes.deinit(allocator);
......@@ -276,10 +276,10 @@ pub const MergeSubsection = struct {
276276pub const InputMergeSection = struct {
277277 merge_section_index: MergeSection.Index = 0,
278278 atom_index: Atom.Index = 0,
279 offsets: std.ArrayListUnmanaged(u32) = .{},
280 subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{},
281 bytes: std.ArrayListUnmanaged(u8) = .{},
282 strings: std.ArrayListUnmanaged(String) = .{},
279 offsets: std.ArrayListUnmanaged(u32) = .empty,
280 subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty,
281 bytes: std.ArrayListUnmanaged(u8) = .empty,
282 strings: std.ArrayListUnmanaged(String) = .empty,
283283
284284 pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void {
285285 imsec.offsets.deinit(allocator);
src/link/Elf/synthetic_sections.zig+9-9
......@@ -1,6 +1,6 @@
11pub const DynamicSection = struct {
22 soname: ?u32 = null,
3 needed: std.ArrayListUnmanaged(u32) = .{},
3 needed: std.ArrayListUnmanaged(u32) = .empty,
44 rpath: u32 = 0,
55
66 pub fn deinit(dt: *DynamicSection, allocator: Allocator) void {
......@@ -226,7 +226,7 @@ pub const DynamicSection = struct {
226226};
227227
228228pub const GotSection = struct {
229 entries: std.ArrayListUnmanaged(Entry) = .{},
229 entries: std.ArrayListUnmanaged(Entry) = .empty,
230230 output_symtab_ctx: Elf.SymtabCtx = .{},
231231 tlsld_index: ?u32 = null,
232232 flags: Flags = .{},
......@@ -629,7 +629,7 @@ pub const GotSection = struct {
629629};
630630
631631pub const PltSection = struct {
632 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},
632 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
633633 output_symtab_ctx: Elf.SymtabCtx = .{},
634634
635635 pub fn deinit(plt: *PltSection, allocator: Allocator) void {
......@@ -883,7 +883,7 @@ pub const GotPltSection = struct {
883883};
884884
885885pub const PltGotSection = struct {
886 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},
886 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
887887 output_symtab_ctx: Elf.SymtabCtx = .{},
888888
889889 pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void {
......@@ -994,7 +994,7 @@ pub const PltGotSection = struct {
994994};
995995
996996pub const CopyRelSection = struct {
997 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},
997 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
998998
999999 pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void {
10001000 copy_rel.symbols.deinit(allocator);
......@@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct {
10721072};
10731073
10741074pub const DynsymSection = struct {
1075 entries: std.ArrayListUnmanaged(Entry) = .{},
1075 entries: std.ArrayListUnmanaged(Entry) = .empty,
10761076
10771077 pub const Entry = struct {
10781078 /// Ref of the symbol which gets privilege of getting a dynamic treatment
......@@ -1156,7 +1156,7 @@ pub const DynsymSection = struct {
11561156};
11571157
11581158pub const HashSection = struct {
1159 buffer: std.ArrayListUnmanaged(u8) = .{},
1159 buffer: std.ArrayListUnmanaged(u8) = .empty,
11601160
11611161 pub fn deinit(hs: *HashSection, allocator: Allocator) void {
11621162 hs.buffer.deinit(allocator);
......@@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct {
13201320};
13211321
13221322pub const VerneedSection = struct {
1323 verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .{},
1324 vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .{},
1323 verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .empty,
1324 vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .empty,
13251325 index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1,
13261326
13271327 pub fn deinit(vern: *VerneedSection, allocator: Allocator) void {
src/link/MachO.zig+21-21
......@@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{},
1313/// Long-lived list of all file descriptors.
1414/// We store them globally rather than per actual File so that we can re-use
1515/// one file handle per every object file within an archive.
16file_handles: std.ArrayListUnmanaged(File.Handle) = .{},
16file_handles: std.ArrayListUnmanaged(File.Handle) = .empty,
1717zig_object: ?File.Index = null,
1818internal_object: ?File.Index = null,
19objects: std.ArrayListUnmanaged(File.Index) = .{},
20dylibs: std.ArrayListUnmanaged(File.Index) = .{},
19objects: std.ArrayListUnmanaged(File.Index) = .empty,
20dylibs: std.ArrayListUnmanaged(File.Index) = .empty,
2121
22segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},
22segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
2323sections: std.MultiArrayList(Section) = .{},
2424
2525resolver: SymbolResolver = .{},
2626/// This table will be populated after `scanRelocs` has run.
2727/// Key is symbol index.
28undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{},
28undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .empty,
2929undefs_mutex: std.Thread.Mutex = .{},
30dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{},
30dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .empty,
3131dupes_mutex: std.Thread.Mutex = .{},
3232
3333dyld_info_cmd: macho.dyld_info_command = .{},
......@@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null,
5252unwind_info_sect_index: ?u8 = null,
5353objc_stubs_sect_index: ?u8 = null,
5454
55thunks: std.ArrayListUnmanaged(Thunk) = .{},
55thunks: std.ArrayListUnmanaged(Thunk) = .empty,
5656
5757/// Output synthetic sections
58symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},
59strtab: std.ArrayListUnmanaged(u8) = .{},
58symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
59strtab: std.ArrayListUnmanaged(u8) = .empty,
6060indsymtab: Indsymtab = .{},
6161got: GotSection = .{},
6262stubs: StubsSection = .{},
......@@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main";
40414041const Section = struct {
40424042 header: macho.section_64,
40434043 segment_id: u8,
4044 atoms: std.ArrayListUnmanaged(Ref) = .{},
4045 free_list: std.ArrayListUnmanaged(Atom.Index) = .{},
4044 atoms: std.ArrayListUnmanaged(Ref) = .empty,
4045 free_list: std.ArrayListUnmanaged(Atom.Index) = .empty,
40464046 last_atom_index: Atom.Index = 0,
4047 thunks: std.ArrayListUnmanaged(Thunk.Index) = .{},
4048 out: std.ArrayListUnmanaged(u8) = .{},
4049 relocs: std.ArrayListUnmanaged(macho.relocation_info) = .{},
4047 thunks: std.ArrayListUnmanaged(Thunk.Index) = .empty,
4048 out: std.ArrayListUnmanaged(u8) = .empty,
4049 relocs: std.ArrayListUnmanaged(macho.relocation_info) = .empty,
40504050};
40514051
40524052pub const LiteralPool = struct {
4053 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},
4054 keys: std.ArrayListUnmanaged(Key) = .{},
4055 values: std.ArrayListUnmanaged(MachO.Ref) = .{},
4056 data: std.ArrayListUnmanaged(u8) = .{},
4053 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
4054 keys: std.ArrayListUnmanaged(Key) = .empty,
4055 values: std.ArrayListUnmanaged(MachO.Ref) = .empty,
4056 data: std.ArrayListUnmanaged(u8) = .empty,
40574057
40584058 pub fn deinit(lp: *LiteralPool, allocator: Allocator) void {
40594059 lp.table.deinit(allocator);
......@@ -4480,9 +4480,9 @@ pub const Ref = struct {
44804480};
44814481
44824482pub const SymbolResolver = struct {
4483 keys: std.ArrayListUnmanaged(Key) = .{},
4484 values: std.ArrayListUnmanaged(Ref) = .{},
4485 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},
4483 keys: std.ArrayListUnmanaged(Key) = .empty,
4484 values: std.ArrayListUnmanaged(Ref) = .empty,
4485 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
44864486
44874487 const Result = struct {
44884488 found_existing: bool,
src/link/MachO/Archive.zig+2-2
......@@ -1,4 +1,4 @@
1objects: std.ArrayListUnmanaged(Object) = .{},
1objects: std.ArrayListUnmanaged(Object) = .empty,
22
33pub fn deinit(self: *Archive, allocator: Allocator) void {
44 self.objects.deinit(allocator);
......@@ -181,7 +181,7 @@ pub const ar_hdr = extern struct {
181181};
182182
183183pub const ArSymtab = struct {
184 entries: std.ArrayListUnmanaged(Entry) = .{},
184 entries: std.ArrayListUnmanaged(Entry) = .empty,
185185 strtab: StringTable = .{},
186186
187187 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {
src/link/MachO/CodeSignature.zig+1-1
......@@ -53,7 +53,7 @@ const CodeDirectory = struct {
5353 inner: macho.CodeDirectory,
5454 ident: []const u8,
5555 special_slots: [n_special_slots][hash_size]u8,
56 code_slots: std.ArrayListUnmanaged([hash_size]u8) = .{},
56 code_slots: std.ArrayListUnmanaged([hash_size]u8) = .empty,
5757
5858 const n_special_slots: usize = 7;
5959
src/link/MachO/DebugSymbols.zig+5-5
......@@ -4,8 +4,8 @@ file: fs.File,
44symtab_cmd: macho.symtab_command = .{},
55uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 },
66
7segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},
8sections: std.ArrayListUnmanaged(macho.section_64) = .{},
7segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
8sections: std.ArrayListUnmanaged(macho.section_64) = .empty,
99
1010dwarf_segment_cmd_index: ?u8 = null,
1111linkedit_segment_cmd_index: ?u8 = null,
......@@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null,
1919debug_loclists_section_index: ?u8 = null,
2020debug_rnglists_section_index: ?u8 = null,
2121
22relocs: std.ArrayListUnmanaged(Reloc) = .{},
22relocs: std.ArrayListUnmanaged(Reloc) = .empty,
2323
2424/// Output synthetic sections
25symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},
26strtab: std.ArrayListUnmanaged(u8) = .{},
25symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
26strtab: std.ArrayListUnmanaged(u8) = .empty,
2727
2828pub const Reloc = struct {
2929 type: enum {
src/link/MachO/Dylib.zig+7-7
......@@ -6,15 +6,15 @@ file_handle: File.HandleIndex,
66tag: enum { dylib, tbd },
77
88exports: std.MultiArrayList(Export) = .{},
9strtab: std.ArrayListUnmanaged(u8) = .{},
9strtab: std.ArrayListUnmanaged(u8) = .empty,
1010id: ?Id = null,
1111ordinal: u16 = 0,
1212
13symbols: std.ArrayListUnmanaged(Symbol) = .{},
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},
15globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},
16dependents: std.ArrayListUnmanaged(Id) = .{},
17rpaths: std.StringArrayHashMapUnmanaged(void) = .{},
13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
16dependents: std.ArrayListUnmanaged(Id) = .empty,
17rpaths: std.StringArrayHashMapUnmanaged(void) = .empty,
1818umbrella: File.Index,
1919platform: ?MachO.Platform = null,
2020
......@@ -742,7 +742,7 @@ pub const TargetMatcher = struct {
742742 allocator: Allocator,
743743 cpu_arch: std.Target.Cpu.Arch,
744744 platform: macho.PLATFORM,
745 target_strings: std.ArrayListUnmanaged([]const u8) = .{},
745 target_strings: std.ArrayListUnmanaged([]const u8) = .empty,
746746
747747 pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher {
748748 var self = TargetMatcher{
src/link/MachO/InternalObject.zig+13-13
......@@ -1,19 +1,19 @@
11index: File.Index,
22
33sections: std.MultiArrayList(Section) = .{},
4atoms: std.ArrayListUnmanaged(Atom) = .{},
5atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},
6atoms_extra: std.ArrayListUnmanaged(u32) = .{},
7symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},
8strtab: std.ArrayListUnmanaged(u8) = .{},
9symbols: std.ArrayListUnmanaged(Symbol) = .{},
10symbols_extra: std.ArrayListUnmanaged(u32) = .{},
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},
12
13objc_methnames: std.ArrayListUnmanaged(u8) = .{},
4atoms: std.ArrayListUnmanaged(Atom) = .empty,
5atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
6atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
7symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
8strtab: std.ArrayListUnmanaged(u8) = .empty,
9symbols: std.ArrayListUnmanaged(Symbol) = .empty,
10symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
12
13objc_methnames: std.ArrayListUnmanaged(u8) = .empty,
1414objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),
1515
16force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .{},
16force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .empty,
1717entry_index: ?Symbol.Index = null,
1818dyld_stub_binder_index: ?Symbol.Index = null,
1919dyld_private_index: ?Symbol.Index = null,
......@@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null,
2121mh_execute_header_index: ?Symbol.Index = null,
2222mh_dylib_header_index: ?Symbol.Index = null,
2323dso_handle_index: ?Symbol.Index = null,
24boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},
24boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
2525
2626output_symtab_ctx: MachO.SymtabCtx = .{},
2727
......@@ -849,7 +849,7 @@ fn formatSymtab(
849849
850850const Section = struct {
851851 header: macho.section_64,
852 relocs: std.ArrayListUnmanaged(Relocation) = .{},
852 relocs: std.ArrayListUnmanaged(Relocation) = .empty,
853853 extra: Extra = .{},
854854
855855 const Extra = packed struct {
src/link/MachO/Object.zig+17-17
......@@ -9,27 +9,27 @@ in_archive: ?InArchive = null,
99header: ?macho.mach_header_64 = null,
1010sections: std.MultiArrayList(Section) = .{},
1111symtab: std.MultiArrayList(Nlist) = .{},
12strtab: std.ArrayListUnmanaged(u8) = .{},
12strtab: std.ArrayListUnmanaged(u8) = .empty,
1313
14symbols: std.ArrayListUnmanaged(Symbol) = .{},
15symbols_extra: std.ArrayListUnmanaged(u32) = .{},
16globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},
17atoms: std.ArrayListUnmanaged(Atom) = .{},
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},
19atoms_extra: std.ArrayListUnmanaged(u32) = .{},
14symbols: std.ArrayListUnmanaged(Symbol) = .empty,
15symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
16globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
17atoms: std.ArrayListUnmanaged(Atom) = .empty,
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
19atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
2020
2121platform: ?MachO.Platform = null,
2222compile_unit: ?CompileUnit = null,
23stab_files: std.ArrayListUnmanaged(StabFile) = .{},
23stab_files: std.ArrayListUnmanaged(StabFile) = .empty,
2424
2525eh_frame_sect_index: ?u8 = null,
2626compact_unwind_sect_index: ?u8 = null,
27cies: std.ArrayListUnmanaged(Cie) = .{},
28fdes: std.ArrayListUnmanaged(Fde) = .{},
29eh_frame_data: std.ArrayListUnmanaged(u8) = .{},
30unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .{},
31unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .{},
32data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .{},
27cies: std.ArrayListUnmanaged(Cie) = .empty,
28fdes: std.ArrayListUnmanaged(Fde) = .empty,
29eh_frame_data: std.ArrayListUnmanaged(u8) = .empty,
30unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .empty,
31unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .empty,
32data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .empty,
3333
3434alive: bool = true,
3535hidden: bool = false,
......@@ -2675,8 +2675,8 @@ fn formatPath(
26752675
26762676const Section = struct {
26772677 header: macho.section_64,
2678 subsections: std.ArrayListUnmanaged(Subsection) = .{},
2679 relocs: std.ArrayListUnmanaged(Relocation) = .{},
2678 subsections: std.ArrayListUnmanaged(Subsection) = .empty,
2679 relocs: std.ArrayListUnmanaged(Relocation) = .empty,
26802680};
26812681
26822682const Subsection = struct {
......@@ -2692,7 +2692,7 @@ pub const Nlist = struct {
26922692
26932693const StabFile = struct {
26942694 comp_dir: u32,
2695 stabs: std.ArrayListUnmanaged(Stab) = .{},
2695 stabs: std.ArrayListUnmanaged(Stab) = .empty,
26962696
26972697 fn getCompDir(sf: StabFile, object: Object) [:0]const u8 {
26982698 const nlist = object.symtab.items(.nlist)[sf.comp_dir];
src/link/MachO/Thunk.zig+1-1
......@@ -1,6 +1,6 @@
11value: u64 = 0,
22out_n_sect: u8 = 0,
3symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .{},
3symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty,
44output_symtab_ctx: MachO.SymtabCtx = .{},
55
66pub fn deinit(thunk: *Thunk, allocator: Allocator) void {
src/link/MachO/UnwindInfo.zig+4-4
......@@ -1,6 +1,6 @@
11/// List of all unwind records gathered from all objects and sorted
22/// by allocated relative function address within the section.
3records: std.ArrayListUnmanaged(Record.Ref) = .{},
3records: std.ArrayListUnmanaged(Record.Ref) = .empty,
44
55/// List of all personalities referenced by either unwind info entries
66/// or __eh_frame entries.
......@@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined,
1212common_encodings_count: u7 = 0,
1313
1414/// List of record indexes containing an LSDA pointer.
15lsdas: std.ArrayListUnmanaged(u32) = .{},
16lsdas_lookup: std.ArrayListUnmanaged(u32) = .{},
15lsdas: std.ArrayListUnmanaged(u32) = .empty,
16lsdas_lookup: std.ArrayListUnmanaged(u32) = .empty,
1717
1818/// List of second level pages.
19pages: std.ArrayListUnmanaged(Page) = .{},
19pages: std.ArrayListUnmanaged(Page) = .empty,
2020
2121pub fn deinit(info: *UnwindInfo, allocator: Allocator) void {
2222 info.records.deinit(allocator);
src/link/MachO/ZigObject.zig+9-9
......@@ -1,4 +1,4 @@
1data: std.ArrayListUnmanaged(u8) = .{},
1data: std.ArrayListUnmanaged(u8) = .empty,
22/// Externally owned memory.
33path: []const u8,
44index: File.Index,
......@@ -6,15 +6,15 @@ index: File.Index,
66symtab: std.MultiArrayList(Nlist) = .{},
77strtab: StringTable = .{},
88
9symbols: std.ArrayListUnmanaged(Symbol) = .{},
10symbols_extra: std.ArrayListUnmanaged(u32) = .{},
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},
9symbols: std.ArrayListUnmanaged(Symbol) = .empty,
10symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
1212/// Maps string index (so name) into nlist index for the global symbol defined within this
1313/// module.
14globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .{},
15atoms: std.ArrayListUnmanaged(Atom) = .{},
16atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},
17atoms_extra: std.ArrayListUnmanaged(u32) = .{},
14globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .empty,
15atoms: std.ArrayListUnmanaged(Atom) = .empty,
16atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
17atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
1818
1919/// Table of tracked LazySymbols.
2020lazy_syms: LazySymbolTable = .{},
......@@ -1786,7 +1786,7 @@ fn formatAtoms(
17861786const AvMetadata = struct {
17871787 symbol_index: Symbol.Index,
17881788 /// A list of all exports aliases of this Av.
1789 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},
1789 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
17901790
17911791 fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 {
17921792 for (m.exports.items) |*exp| {
src/link/MachO/dyld_info/Rebase.zig+2-2
......@@ -1,5 +1,5 @@
1entries: std.ArrayListUnmanaged(Entry) = .{},
2buffer: std.ArrayListUnmanaged(u8) = .{},
1entries: std.ArrayListUnmanaged(Entry) = .empty,
2buffer: std.ArrayListUnmanaged(u8) = .empty,
33
44pub const Entry = struct {
55 offset: u64,
src/link/MachO/dyld_info/Trie.zig+3-3
......@@ -31,9 +31,9 @@
3131
3232/// The root node of the trie.
3333root: ?Node.Index = null,
34buffer: std.ArrayListUnmanaged(u8) = .{},
34buffer: std.ArrayListUnmanaged(u8) = .empty,
3535nodes: std.MultiArrayList(Node) = .{},
36edges: std.ArrayListUnmanaged(Edge) = .{},
36edges: std.ArrayListUnmanaged(Edge) = .empty,
3737
3838/// Insert a symbol into the trie, updating the prefixes in the process.
3939/// This operation may change the layout of the trie by splicing edges in
......@@ -317,7 +317,7 @@ const Node = struct {
317317 trie_offset: u32 = 0,
318318
319319 /// List of all edges originating from this node.
320 edges: std.ArrayListUnmanaged(Edge.Index) = .{},
320 edges: std.ArrayListUnmanaged(Edge.Index) = .empty,
321321
322322 const Index = u32;
323323};
src/link/MachO/dyld_info/bind.zig+7-7
......@@ -17,8 +17,8 @@ pub const Entry = struct {
1717};
1818
1919pub const Bind = struct {
20 entries: std.ArrayListUnmanaged(Entry) = .{},
21 buffer: std.ArrayListUnmanaged(u8) = .{},
20 entries: std.ArrayListUnmanaged(Entry) = .empty,
21 buffer: std.ArrayListUnmanaged(u8) = .empty,
2222
2323 const Self = @This();
2424
......@@ -269,8 +269,8 @@ pub const Bind = struct {
269269};
270270
271271pub const WeakBind = struct {
272 entries: std.ArrayListUnmanaged(Entry) = .{},
273 buffer: std.ArrayListUnmanaged(u8) = .{},
272 entries: std.ArrayListUnmanaged(Entry) = .empty,
273 buffer: std.ArrayListUnmanaged(u8) = .empty,
274274
275275 const Self = @This();
276276
......@@ -511,9 +511,9 @@ pub const WeakBind = struct {
511511};
512512
513513pub const LazyBind = struct {
514 entries: std.ArrayListUnmanaged(Entry) = .{},
515 buffer: std.ArrayListUnmanaged(u8) = .{},
516 offsets: std.ArrayListUnmanaged(u32) = .{},
514 entries: std.ArrayListUnmanaged(Entry) = .empty,
515 buffer: std.ArrayListUnmanaged(u8) = .empty,
516 offsets: std.ArrayListUnmanaged(u32) = .empty,
517517
518518 const Self = @This();
519519
src/link/MachO/synthetic.zig+5-5
......@@ -1,5 +1,5 @@
11pub const GotSection = struct {
2 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},
2 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
33
44 pub const Index = u32;
55
......@@ -68,7 +68,7 @@ pub const GotSection = struct {
6868};
6969
7070pub const StubsSection = struct {
71 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},
71 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
7272
7373 pub const Index = u32;
7474
......@@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct {
316316};
317317
318318pub const TlvPtrSection = struct {
319 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},
319 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
320320
321321 pub const Index = u32;
322322
......@@ -388,7 +388,7 @@ pub const TlvPtrSection = struct {
388388};
389389
390390pub const ObjcStubsSection = struct {
391 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},
391 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
392392
393393 pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void {
394394 objc.symbols.deinit(allocator);
......@@ -548,7 +548,7 @@ pub const Indsymtab = struct {
548548};
549549
550550pub const DataInCode = struct {
551 entries: std.ArrayListUnmanaged(Entry) = .{},
551 entries: std.ArrayListUnmanaged(Entry) = .empty,
552552
553553 pub fn deinit(dice: *DataInCode, allocator: Allocator) void {
554554 dice.entries.deinit(allocator);
src/link/Plan9.zig+12-12
......@@ -34,13 +34,13 @@ bases: Bases,
3434/// Does not represent the order or amount of symbols in the file
3535/// it is just useful for storing symbols. Some other symbols are in
3636/// file_segments.
37syms: std.ArrayListUnmanaged(aout.Sym) = .{},
37syms: std.ArrayListUnmanaged(aout.Sym) = .empty,
3838
3939/// The plan9 a.out format requires segments of
4040/// filenames to be deduplicated, so we use this map to
4141/// de duplicate it. The value is the value of the path
4242/// component
43file_segments: std.StringArrayHashMapUnmanaged(u16) = .{},
43file_segments: std.StringArrayHashMapUnmanaged(u16) = .empty,
4444/// The value of a 'f' symbol increments by 1 every time, so that no 2 'f'
4545/// symbols have the same value.
4646file_segments_i: u16 = 1,
......@@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator,
5454/// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place)
5555fn_nav_table: std.AutoArrayHashMapUnmanaged(
5656 Zcu.File.Index,
57 struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .{} },
57 struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .empty },
5858) = .{},
5959/// the code is modified when relocated, so that is why it is mutable
60data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .{},
60data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .empty,
6161/// When `updateExports` is called, we store the export indices here, to be used
6262/// during flush.
63nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .{},
63nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .empty,
6464
6565lazy_syms: LazySymbolTable = .{},
6666
67uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .{},
67uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty,
6868
69relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .{},
69relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .empty,
7070hdr: aout.ExecHdr = undefined,
7171
7272// relocs: std.
......@@ -77,12 +77,12 @@ entry_val: ?u64 = null,
7777got_len: usize = 0,
7878// A list of all the free got indexes, so when making a new decl
7979// don't make a new one, just use one from here.
80got_index_free_list: std.ArrayListUnmanaged(usize) = .{},
80got_index_free_list: std.ArrayListUnmanaged(usize) = .empty,
8181
82syms_index_free_list: std.ArrayListUnmanaged(usize) = .{},
82syms_index_free_list: std.ArrayListUnmanaged(usize) = .empty,
8383
84atoms: std.ArrayListUnmanaged(Atom) = .{},
85navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .{},
84atoms: std.ArrayListUnmanaged(Atom) = .empty,
85navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .empty,
8686
8787/// Indices of the three "special" symbols into atoms
8888etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null },
......@@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct {
220220
221221const NavMetadata = struct {
222222 index: Atom.Index,
223 exports: std.ArrayListUnmanaged(usize) = .{},
223 exports: std.ArrayListUnmanaged(usize) = .empty,
224224
225225 fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize {
226226 for (m.exports.items) |exp| {
src/link/SpirV/BinaryModule.zig+1-1
......@@ -148,7 +148,7 @@ pub const Parser = struct {
148148 a: Allocator,
149149
150150 /// Maps (instruction set, opcode) => instruction index (for instruction set)
151 opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .{},
151 opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty,
152152
153153 pub fn init(a: Allocator) !Parser {
154154 var self = Parser{
src/link/SpirV/deduplicate.zig+2-2
......@@ -178,8 +178,8 @@ const ModuleInfo = struct {
178178
179179const EntityContext = struct {
180180 a: Allocator,
181 ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{},
182 ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{},
181 ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty,
182 ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty,
183183 info: *const ModuleInfo,
184184 binary: *const BinaryModule,
185185
src/link/SpirV/lower_invocation_globals.zig+2-2
......@@ -342,9 +342,9 @@ const ModuleBuilder = struct {
342342 entry_point_new_id_base: u32,
343343 /// A set of all function types in the new program. SPIR-V mandates that these are unique,
344344 /// and until a general type deduplication pass is programmed, we just handle it here via this.
345 function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .{},
345 function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty,
346346 /// Maps functions to new information required for creating the module
347 function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .{},
347 function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .empty,
348348 /// Offset of the functions section in the new binary.
349349 new_functions_section: ?usize,
350350
src/link/StringTable.zig+2-2
......@@ -1,5 +1,5 @@
1buffer: std.ArrayListUnmanaged(u8) = .{},
2table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{},
1buffer: std.ArrayListUnmanaged(u8) = .empty,
2table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
33
44pub fn deinit(self: *Self, gpa: Allocator) void {
55 self.buffer.deinit(gpa);
src/link/Wasm.zig+23-23
......@@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{},
7272/// TODO: Allow setting this through a flag?
7373host_name: []const u8 = "env",
7474/// List of symbols generated by the linker.
75synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .{},
75synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .empty,
7676/// Maps atoms to their segment index
77atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{},
77atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty,
7878/// List of all atoms.
79managed_atoms: std.ArrayListUnmanaged(Atom) = .{},
79managed_atoms: std.ArrayListUnmanaged(Atom) = .empty,
8080/// Represents the index into `segments` where the 'code' section
8181/// lives.
8282code_section_index: ?u32 = null,
......@@ -106,22 +106,22 @@ imported_globals_count: u32 = 0,
106106/// to the table indexes when sections are merged.
107107imported_tables_count: u32 = 0,
108108/// Map of symbol locations, represented by its `types.Import`
109imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .{},
109imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .empty,
110110/// Represents non-synthetic section entries.
111111/// Used for code, data and custom sections.
112segments: std.ArrayListUnmanaged(Segment) = .{},
112segments: std.ArrayListUnmanaged(Segment) = .empty,
113113/// Maps a data segment key (such as .rodata) to the index into `segments`.
114data_segments: std.StringArrayHashMapUnmanaged(u32) = .{},
114data_segments: std.StringArrayHashMapUnmanaged(u32) = .empty,
115115/// A table of `types.Segment` which provide meta data
116116/// about a data symbol such as its name where the key is
117117/// the segment index, which can be found from `data_segments`
118segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .{},
118segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .empty,
119119/// Deduplicated string table for strings used by symbols, imports and exports.
120120string_table: StringTable = .{},
121121
122122// Output sections
123123/// Output type section
124func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{},
124func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty,
125125/// Output function section where the key is the original
126126/// function index and the value is function.
127127/// This allows us to map multiple symbols to the same function.
......@@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged(
130130 struct { func: std.wasm.Func, sym_index: Symbol.Index },
131131) = .{},
132132/// Output global section
133wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .{},
133wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty,
134134/// Memory section
135135memories: std.wasm.Memory = .{ .limits = .{
136136 .min = 0,
......@@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{
138138 .flags = 0,
139139} },
140140/// Output table section
141tables: std.ArrayListUnmanaged(std.wasm.Table) = .{},
141tables: std.ArrayListUnmanaged(std.wasm.Table) = .empty,
142142/// Output export section
143exports: std.ArrayListUnmanaged(types.Export) = .{},
143exports: std.ArrayListUnmanaged(types.Export) = .empty,
144144/// List of initialization functions. These must be called in order of priority
145145/// by the (synthetic) __wasm_call_ctors function.
146init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .{},
146init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .empty,
147147/// Index to a function defining the entry of the wasm file
148148entry: ?u32 = null,
149149
......@@ -152,31 +152,31 @@ entry: ?u32 = null,
152152/// as well as an 'elements' section.
153153///
154154/// Note: Key is symbol location, value represents the index into the table
155function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .{},
155function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .empty,
156156
157157/// All object files and their data which are linked into the final binary
158objects: std.ArrayListUnmanaged(File.Index) = .{},
158objects: std.ArrayListUnmanaged(File.Index) = .empty,
159159/// All archive files that are lazy loaded.
160160/// e.g. when an undefined symbol references a symbol from the archive.
161archives: std.ArrayListUnmanaged(Archive) = .{},
161archives: std.ArrayListUnmanaged(Archive) = .empty,
162162
163163/// A map of global names (read: offset into string table) to their symbol location
164globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .{},
164globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .empty,
165165/// The list of GOT symbols and their location
166got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .{},
166got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .empty,
167167/// Maps discarded symbols and their positions to the location of the symbol
168168/// it was resolved to
169discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .{},
169discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .empty,
170170/// List of all symbol locations which have been resolved by the linker and will be emit
171171/// into the final binary.
172resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .{},
172resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .empty,
173173/// Symbols that remain undefined after symbol resolution.
174174/// Note: The key represents an offset into the string table, rather than the actual string.
175undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .{},
175undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .empty,
176176/// Maps a symbol's location to an atom. This can be used to find meta
177177/// data of a symbol, such as its size, or its offset to perform a relocation.
178178/// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped.
179symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .{},
179symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .empty,
180180
181181pub const Alignment = types.Alignment;
182182
......@@ -287,7 +287,7 @@ pub const StringTable = struct {
287287 std.hash_map.default_max_load_percentage,
288288 ) = .{},
289289 /// Holds the actual data of the string table.
290 string_data: std.ArrayListUnmanaged(u8) = .{},
290 string_data: std.ArrayListUnmanaged(u8) = .empty,
291291
292292 /// Accepts a string and searches for a corresponding string.
293293 /// When found, de-duplicates the string and returns the existing offset instead.
......@@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void {
16981698
16991699fn sortDataSegments(wasm: *Wasm) !void {
17001700 const gpa = wasm.base.comp.gpa;
1701 var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .{};
1701 var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .empty;
17021702 try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count());
17031703 errdefer new_mapping.deinit(gpa);
17041704
src/link/Wasm/Archive.zig+1-1
......@@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined,
1212/// Parsed table of contents.
1313/// Each symbol name points to a list of all definition
1414/// sites within the current static archive.
15toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .{},
15toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .empty,
1616
1717// Archive files start with the ARMAG identifying string. Then follows a
1818// `struct ar_hdr', and as many bytes of member file data as its `ar_size'
src/link/Wasm/Atom.zig+3-3
......@@ -6,9 +6,9 @@ sym_index: Symbol.Index,
66/// Size of the atom, used to calculate section sizes in the final binary
77size: u32 = 0,
88/// List of relocations belonging to this atom
9relocs: std.ArrayListUnmanaged(types.Relocation) = .{},
9relocs: std.ArrayListUnmanaged(types.Relocation) = .empty,
1010/// Contains the binary data of an atom, which can be non-relocated
11code: std.ArrayListUnmanaged(u8) = .{},
11code: std.ArrayListUnmanaged(u8) = .empty,
1212/// For code this is 1, for data this is set to the highest value of all segments
1313alignment: Wasm.Alignment = .@"1",
1414/// Offset into the section where the atom lives, this already accounts
......@@ -22,7 +22,7 @@ original_offset: u32 = 0,
2222prev: Atom.Index = .null,
2323/// Contains atoms local to a decl, all managed by this `Atom`.
2424/// When the parent atom is being freed, it will also do so for all local atoms.
25locals: std.ArrayListUnmanaged(Atom.Index) = .{},
25locals: std.ArrayListUnmanaged(Atom.Index) = .empty,
2626
2727/// Represents the index of an Atom where `null` is considered
2828/// an invalid atom.
src/link/Wasm/Object.zig+3-3
......@@ -51,7 +51,7 @@ start: ?u32 = null,
5151features: []const types.Feature = &.{},
5252/// A table that maps the relocations we must perform where the key represents
5353/// the section that the list of relocations applies to.
54relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .{},
54relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .empty,
5555/// Table of symbols belonging to this Object file
5656symtable: []Symbol = &.{},
5757/// Extra metadata about the linking section, such as alignment of segments and their name
......@@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{},
6262comdat_info: []const types.Comdat = &.{},
6363/// Represents non-synthetic sections that can essentially be mem-cpy'd into place
6464/// after performing relocations.
65relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .{},
65relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .empty,
6666/// String table for all strings required by the object file, such as symbol names,
6767/// import name, module name and export names. Each string will be deduplicated
6868/// and returns an offset into the table.
......@@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type {
379379 try parser.parseFeatures(gpa);
380380 } else if (std.mem.startsWith(u8, name, ".debug")) {
381381 const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom);
382 var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .{};
382 var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .empty;
383383 defer relocatable_data.deinit(gpa);
384384 if (!gop.found_existing) {
385385 gop.value_ptr.* = &.{};
src/link/Wasm/ZigObject.zig+15-15
......@@ -8,37 +8,37 @@ path: []const u8,
88index: File.Index,
99/// Map of all `Nav` that are currently alive.
1010/// Each index maps to the corresponding `NavInfo`.
11navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .{},
11navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .empty,
1212/// List of function type signatures for this Zig module.
13func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{},
13func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty,
1414/// List of `std.wasm.Func`. Each entry contains the function signature,
1515/// rather than the actual body.
16functions: std.ArrayListUnmanaged(std.wasm.Func) = .{},
16functions: std.ArrayListUnmanaged(std.wasm.Func) = .empty,
1717/// List of indexes pointing to an entry within the `functions` list which has been removed.
18functions_free_list: std.ArrayListUnmanaged(u32) = .{},
18functions_free_list: std.ArrayListUnmanaged(u32) = .empty,
1919/// Map of symbol locations, represented by its `types.Import`.
20imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .{},
20imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .empty,
2121/// List of WebAssembly globals.
22globals: std.ArrayListUnmanaged(std.wasm.Global) = .{},
22globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty,
2323/// Mapping between an `Atom` and its type index representing the Wasm
2424/// type of the function signature.
25atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .{},
25atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .empty,
2626/// List of all symbols generated by Zig code.
27symbols: std.ArrayListUnmanaged(Symbol) = .{},
27symbols: std.ArrayListUnmanaged(Symbol) = .empty,
2828/// Map from symbol name offset to their index into the `symbols` list.
29global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{},
29global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty,
3030/// List of symbol indexes which are free to be used.
31symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .{},
31symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .empty,
3232/// Extra metadata about the linking section, such as alignment of segments and their name.
33segment_info: std.ArrayListUnmanaged(types.Segment) = .{},
33segment_info: std.ArrayListUnmanaged(types.Segment) = .empty,
3434/// List of indexes which contain a free slot in the `segment_info` list.
35segment_free_list: std.ArrayListUnmanaged(u32) = .{},
35segment_free_list: std.ArrayListUnmanaged(u32) = .empty,
3636/// File encapsulated string table, used to deduplicate strings within the generated file.
3737string_table: StringTable = .{},
3838/// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index.
39uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .{},
39uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty,
4040/// List of atom indexes of functions that are generated by the backend.
41synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .{},
41synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .empty,
4242/// Represents the symbol index of the error name table
4343/// When this is `null`, no code references an error using runtime `@errorName`.
4444/// During initializion, a symbol with corresponding atom will be created that is
......@@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null,
8888
8989const NavInfo = struct {
9090 atom: Atom.Index = .null,
91 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},
91 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
9292
9393 fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index {
9494 for (ni.exports.items) |sym_index| {
src/link/table_section.zig+3-3
......@@ -1,8 +1,8 @@
11pub fn TableSection(comptime Entry: type) type {
22 return struct {
3 entries: std.ArrayListUnmanaged(Entry) = .{},
4 free_list: std.ArrayListUnmanaged(Index) = .{},
5 lookup: std.AutoHashMapUnmanaged(Entry, Index) = .{},
3 entries: std.ArrayListUnmanaged(Entry) = .empty,
4 free_list: std.ArrayListUnmanaged(Index) = .empty,
5 lookup: std.AutoHashMapUnmanaged(Entry, Index) = .empty,
66
77 pub fn deinit(self: *Self, allocator: Allocator) void {
88 self.entries.deinit(allocator);
src/link/tapi/parse.zig+4-4
......@@ -115,7 +115,7 @@ pub const Node = struct {
115115 .start = undefined,
116116 .end = undefined,
117117 },
118 values: std.ArrayListUnmanaged(Entry) = .{},
118 values: std.ArrayListUnmanaged(Entry) = .empty,
119119
120120 pub const base_tag: Node.Tag = .map;
121121
......@@ -161,7 +161,7 @@ pub const Node = struct {
161161 .start = undefined,
162162 .end = undefined,
163163 },
164 values: std.ArrayListUnmanaged(*Node) = .{},
164 values: std.ArrayListUnmanaged(*Node) = .empty,
165165
166166 pub const base_tag: Node.Tag = .list;
167167
......@@ -195,7 +195,7 @@ pub const Node = struct {
195195 .start = undefined,
196196 .end = undefined,
197197 },
198 string_value: std.ArrayListUnmanaged(u8) = .{},
198 string_value: std.ArrayListUnmanaged(u8) = .empty,
199199
200200 pub const base_tag: Node.Tag = .value;
201201
......@@ -227,7 +227,7 @@ pub const Tree = struct {
227227 source: []const u8,
228228 tokens: []Token,
229229 line_cols: std.AutoHashMap(TokenIndex, LineCol),
230 docs: std.ArrayListUnmanaged(*Node) = .{},
230 docs: std.ArrayListUnmanaged(*Node) = .empty,
231231
232232 pub fn init(allocator: Allocator) Tree {
233233 return .{
src/main.zig+15-15
......@@ -126,7 +126,7 @@ const debug_usage = normal_usage ++
126126const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage;
127127const default_local_zig_cache_basename = ".zig-cache";
128128
129var log_scopes: std.ArrayListUnmanaged([]const u8) = .{};
129var log_scopes: std.ArrayListUnmanaged([]const u8) = .empty;
130130
131131pub fn log(
132132 comptime level: std.log.Level,
......@@ -895,14 +895,14 @@ fn buildOutputType(
895895 var linker_module_definition_file: ?[]const u8 = null;
896896 var test_no_exec = false;
897897 var entry: Compilation.CreateOptions.Entry = .default;
898 var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{};
898 var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty;
899899 var stack_size: ?u64 = null;
900900 var image_base: ?u64 = null;
901901 var link_eh_frame_hdr = false;
902902 var link_emit_relocs = false;
903903 var build_id: ?std.zig.BuildId = null;
904904 var runtime_args_start: ?usize = null;
905 var test_filters: std.ArrayListUnmanaged([]const u8) = .{};
905 var test_filters: std.ArrayListUnmanaged([]const u8) = .empty;
906906 var test_name_prefix: ?[]const u8 = null;
907907 var test_runner_path: ?[]const u8 = null;
908908 var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena);
......@@ -931,12 +931,12 @@ fn buildOutputType(
931931 var pdb_out_path: ?[]const u8 = null;
932932 var error_limit: ?Zcu.ErrorInt = null;
933933 // These are before resolving sysroot.
934 var extra_cflags: std.ArrayListUnmanaged([]const u8) = .{};
935 var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .{};
936 var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{};
934 var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty;
935 var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty;
936 var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty;
937937 var rc_includes: Compilation.RcIncludes = .any;
938938 var manifest_file: ?[]const u8 = null;
939 var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{};
939 var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .empty;
940940
941941 // Tracks the position in c_source_files which have already their owner populated.
942942 var c_source_files_owner_index: usize = 0;
......@@ -944,7 +944,7 @@ fn buildOutputType(
944944 var rc_source_files_owner_index: usize = 0;
945945
946946 // null means replace with the test executable binary
947 var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .{};
947 var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .empty;
948948
949949 // These get set by CLI flags and then snapshotted when a `-M` flag is
950950 // encountered.
......@@ -953,8 +953,8 @@ fn buildOutputType(
953953 // These get appended to by CLI flags and then slurped when a `-M` flag
954954 // is encountered.
955955 var cssan: ClangSearchSanitizer = .{};
956 var cc_argv: std.ArrayListUnmanaged([]const u8) = .{};
957 var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{};
956 var cc_argv: std.ArrayListUnmanaged([]const u8) = .empty;
957 var deps: std.ArrayListUnmanaged(CliModule.Dep) = .empty;
958958
959959 // Contains every module specified via -M. The dependencies are added
960960 // after argument parsing is completed. We use a StringArrayHashMap to make
......@@ -2806,7 +2806,7 @@ fn buildOutputType(
28062806 create_module.opts.emit_bin = emit_bin != .no;
28072807 create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0;
28082808
2809 var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .{};
2809 var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .empty;
28102810 // `builtin_modules` allocated into `arena`, so no deinit
28112811 const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules);
28122812 for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| {
......@@ -3290,7 +3290,7 @@ fn buildOutputType(
32903290
32913291 process.raiseFileDescriptorLimit();
32923292
3293 var file_system_inputs: std.ArrayListUnmanaged(u8) = .{};
3293 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;
32943294 defer file_system_inputs.deinit(gpa);
32953295
32963296 const comp = Compilation.create(gpa, arena, .{
......@@ -5451,7 +5451,7 @@ fn jitCmd(
54515451 });
54525452 defer thread_pool.deinit();
54535453
5454 var child_argv: std.ArrayListUnmanaged([]const u8) = .{};
5454 var child_argv: std.ArrayListUnmanaged([]const u8) = .empty;
54555455 try child_argv.ensureUnusedCapacity(arena, args.len + 4);
54565456
54575457 // We want to release all the locks before executing the child process, so we make a nice
......@@ -6553,7 +6553,7 @@ fn cmdChangelist(
65536553 process.exit(1);
65546554 }
65556555
6556 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{};
6556 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty;
65576557 defer inst_map.deinit(gpa);
65586558
65596559 try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map);
......@@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem {
67386738/// Silently ignore superfluous search dirs.
67396739/// Warn when a dir is added to multiple searchlists.
67406740const ClangSearchSanitizer = struct {
6741 map: std.StringHashMapUnmanaged(Membership) = .{},
6741 map: std.StringHashMapUnmanaged(Membership) = .empty,
67426742
67436743 fn reset(self: *@This()) void {
67446744 self.map.clearRetainingCapacity();
src/register_manager.zig+1-1
......@@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type {
516516 return struct {
517517 allocator: Allocator,
518518 register_manager: Register.RM = .{},
519 spilled: std.ArrayListUnmanaged(Register) = .{},
519 spilled: std.ArrayListUnmanaged(Register) = .empty,
520520
521521 const Self = @This();
522522
src/translate_c.zig+6-6
......@@ -27,23 +27,23 @@ pub const Context = struct {
2727 gpa: mem.Allocator,
2828 arena: mem.Allocator,
2929 source_manager: *clang.SourceManager,
30 decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{},
30 decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty,
3131 alias_list: AliasList,
3232 global_scope: *Scope.Root,
3333 clang_context: *clang.ASTContext,
3434 mangle_count: u32 = 0,
3535 /// Table of record decls that have been demoted to opaques.
36 opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{},
36 opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty,
3737 /// Table of unnamed enums and records that are child types of typedefs.
38 unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{},
38 unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty,
3939 /// Needed to decide if we are parsing a typename
40 typedefs: std.StringArrayHashMapUnmanaged(void) = .{},
40 typedefs: std.StringArrayHashMapUnmanaged(void) = .empty,
4141
4242 /// This one is different than the root scope's name table. This contains
4343 /// a list of names that we found by visiting all the top level decls without
4444 /// translating them. The other maps are updated as we translate; this one is updated
4545 /// up front in a pre-processing step.
46 global_names: std.StringArrayHashMapUnmanaged(void) = .{},
46 global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
4747
4848 /// This is similar to `global_names`, but contains names which we would
4949 /// *like* to use, but do not strictly *have* to if they are unavailable.
......@@ -52,7 +52,7 @@ pub const Context = struct {
5252 /// may be mangled.
5353 /// This is distinct from `global_names` so we can detect at a type
5454 /// declaration whether or not the name is available.
55 weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{},
55 weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
5656
5757 pattern_list: PatternList,
5858
test/behavior/fn.zig+1-1
......@@ -415,7 +415,7 @@ test "import passed byref to function in return type" {
415415
416416 const S = struct {
417417 fn get() @import("std").ArrayListUnmanaged(i32) {
418 const x: @import("std").ArrayListUnmanaged(i32) = .{};
418 const x: @import("std").ArrayListUnmanaged(i32) = .empty;
419419 return x;
420420 }
421421 };
test/compare_output.zig+3-3
......@@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
291291 \\ stdout.print("before\n", .{}) catch unreachable;
292292 \\ defer stdout.print("defer1\n", .{}) catch unreachable;
293293 \\ defer stdout.print("defer2\n", .{}) catch unreachable;
294 \\ var gpa = @import("std").heap.GeneralPurposeAllocator(.{}){};
294 \\ var gpa: @import("std").heap.GeneralPurposeAllocator(.{}) = .init;
295295 \\ defer _ = gpa.deinit();
296296 \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator());
297297 \\ defer arena.deinit();
......@@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
361361 \\const os = std.os;
362362 \\
363363 \\pub fn main() !void {
364 \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
364 \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
365365 \\ defer _ = gpa.deinit();
366366 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());
367367 \\ defer arena.deinit();
......@@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
402402 \\const os = std.os;
403403 \\
404404 \\pub fn main() !void {
405 \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
405 \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
406406 \\ defer _ = gpa.deinit();
407407 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());
408408 \\ defer arena.deinit();
test/standalone/coff_dwarf/main.zig+1-1
......@@ -5,7 +5,7 @@ const testing = std.testing;
55extern fn add(a: u32, b: u32, addr: *usize) u32;
66
77pub fn main() !void {
8 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
8 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
99 defer assert(gpa.deinit() == .ok);
1010 const allocator = gpa.allocator();
1111
test/standalone/empty_env/main.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 defer _ = gpa.deinit();
66 const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map");
77 try std.testing.expect(env_map.count() == 0);
test/standalone/load_dynamic_library/main.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 defer _ = gpa.deinit();
66 const args = try std.process.argsAlloc(gpa.allocator());
77 defer std.process.argsFree(gpa.allocator(), args);
test/standalone/self_exe_symlink/create-symlink.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() anyerror!void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
66 const allocator = gpa.allocator();
77
test/standalone/self_exe_symlink/main.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 defer std.debug.assert(gpa.deinit() == .ok);
66 const allocator = gpa.allocator();
77
test/standalone/simple/brace_expansion.zig+1-1
......@@ -15,7 +15,7 @@ const Token = union(enum) {
1515 Eof,
1616};
1717
18var gpa = std.heap.GeneralPurposeAllocator(.{}){};
18var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
1919var global_allocator = gpa.allocator();
2020
2121fn tokenize(input: []const u8) !ArrayList(Token) {
test/standalone/windows_argv/fuzz.zig+1-1
......@@ -4,7 +4,7 @@ const windows = std.os.windows;
44const Allocator = std.mem.Allocator;
55
66pub fn main() !void {
7 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
7 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
88 defer std.debug.assert(gpa.deinit() == .ok);
99 const allocator = gpa.allocator();
1010
test/standalone/windows_bat_args/fuzz.zig+1-1
......@@ -3,7 +3,7 @@ const builtin = @import("builtin");
33const Allocator = std.mem.Allocator;
44
55pub fn main() anyerror!void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
77 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
88 const allocator = gpa.allocator();
99
test/standalone/windows_bat_args/test.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22
33pub fn main() anyerror!void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
66 const allocator = gpa.allocator();
77
test/standalone/windows_spawn/main.zig+1-1
......@@ -3,7 +3,7 @@ const windows = std.os.windows;
33const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;
44
55pub fn main() anyerror!void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
77 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
88 const allocator = gpa.allocator();
99
tools/doctest.zig+2-2
......@@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
868868
869869 var mode: std.builtin.OptimizeMode = .Debug;
870870 var link_mode: ?std.builtin.LinkMode = null;
871 var link_objects: std.ArrayListUnmanaged([]const u8) = .{};
872 var additional_options: std.ArrayListUnmanaged([]const u8) = .{};
871 var link_objects: std.ArrayListUnmanaged([]const u8) = .empty;
872 var additional_options: std.ArrayListUnmanaged([]const u8) = .empty;
873873 var target_str: ?[]const u8 = null;
874874 var link_libc = false;
875875 var disable_cache = false;
tools/dump-cov.zig+2-2
......@@ -8,7 +8,7 @@ const assert = std.debug.assert;
88const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader;
99
1010pub fn main() !void {
11 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
11 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
1212 defer _ = general_purpose_allocator.deinit();
1313 const gpa = general_purpose_allocator.allocator();
1414
......@@ -55,7 +55,7 @@ pub fn main() !void {
5555 try stdout.print("{any}\n", .{header.*});
5656 const pcs = header.pcAddrs();
5757
58 var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .{};
58 var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .empty;
5959 try indexed_pcs.entries.resize(arena, pcs.len);
6060 @memcpy(indexed_pcs.entries.items(.key), pcs);
6161 try indexed_pcs.reIndex(arena);
tools/generate_JSONTestSuite.zig+1-1
......@@ -3,7 +3,7 @@
33const std = @import("std");
44
55pub fn main() !void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
77 var allocator = gpa.allocator();
88
99 var output = std.io.getStdOut().writer();
tools/generate_c_size_and_align_checks.zig+1-1
......@@ -25,7 +25,7 @@ fn cName(ty: std.Target.CType) []const u8 {
2525 };
2626}
2727
28var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
28var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
2929
3030pub fn main() !void {
3131 const gpa = general_purpose_allocator.allocator();
tools/incr-check.zig+4-4
......@@ -73,7 +73,7 @@ pub fn main() !void {
7373 else
7474 null;
7575
76 var child_args: std.ArrayListUnmanaged([]const u8) = .{};
76 var child_args: std.ArrayListUnmanaged([]const u8) = .empty;
7777 try child_args.appendSlice(arena, &.{
7878 resolved_zig_exe,
7979 "build-exe",
......@@ -107,7 +107,7 @@ pub fn main() !void {
107107 child.cwd_dir = tmp_dir;
108108 child.cwd = tmp_dir_path;
109109
110 var cc_child_args: std.ArrayListUnmanaged([]const u8) = .{};
110 var cc_child_args: std.ArrayListUnmanaged([]const u8) = .empty;
111111 if (emit == .c) {
112112 const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe|
113113 try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe)
......@@ -492,8 +492,8 @@ const Case = struct {
492492 };
493493
494494 fn parse(arena: Allocator, bytes: []const u8) !Case {
495 var updates: std.ArrayListUnmanaged(Update) = .{};
496 var changes: std.ArrayListUnmanaged(FullContents) = .{};
495 var updates: std.ArrayListUnmanaged(Update) = .empty;
496 var changes: std.ArrayListUnmanaged(FullContents) = .empty;
497497 var target_query: ?[]const u8 = null;
498498 var it = std.mem.splitScalar(u8, bytes, '\n');
499499 var line_n: usize = 1;