| author | |
| committer | |
| log | 0001f91e4e1e51cd64cdd5c0a21451c8bad67233 |
| tree | 9c3efb262890fa76a9b1d02c694dadad11c316f4 |
| parent | b95e0e09dcbe4ca948fd4098a8e3a4d90df9cb22 |
| parent | 9271a89c65967ff0fed7011b4195abdd0f9195eb |
| signature |
Replace deprecated default initializations with decl literals152 files changed, 842 insertions(+), 824 deletions(-)
doc/langref/wasi_args.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() !void { | 3 | pub fn main() !void { |
| 4 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | const gpa = general_purpose_allocator.allocator(); | 5 | const gpa = general_purpose_allocator.allocator(); |
| 6 | const args = try std.process.argsAlloc(gpa); | 6 | const args = try std.process.argsAlloc(gpa); |
| 7 | defer std.process.argsFree(gpa, args); | 7 | defer std.process.argsFree(gpa, args); |
doc/langref/wasi_preopens.zig+1-1| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const fs = std.fs; | 2 | const fs = std.fs; |
| 3 | 3 | ||
| 4 | pub fn main() !void { | 4 | pub fn main() !void { |
| 5 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; | 5 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 6 | const gpa = general_purpose_allocator.allocator(); | 6 | const gpa = general_purpose_allocator.allocator(); |
| 7 | 7 | ||
| 8 | var arena_instance = std.heap.ArenaAllocator.init(gpa); | 8 | 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, | ... | @@ -42,11 +42,11 @@ node_tag: []const Tree.Tag, |
| 42 | node_data: []const Tree.Node.Data, | 42 | node_data: []const Tree.Node.Data, |
| 43 | node_ty: []const Type, | 43 | node_ty: []const Type, |
| 44 | wip_switch: *WipSwitch = undefined, | 44 | wip_switch: *WipSwitch = undefined, |
| 45 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 45 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 46 | ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | 46 | ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty, |
| 47 | phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | 47 | phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty, |
| 48 | record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{}, | 48 | record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty, |
| 49 | record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{}, | 49 | record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty, |
| 50 | cond_dummy_ty: ?Interner.Ref = null, | 50 | cond_dummy_ty: ?Interner.Ref = null, |
| 51 | bool_invert: bool = false, | 51 | bool_invert: bool = false, |
| 52 | bool_end_label: Ir.Ref = .none, | 52 | bool_end_label: Ir.Ref = .none, |
lib/compiler/aro/aro/Compilation.zig+5-5| ... | @@ -93,13 +93,13 @@ gpa: Allocator, | ... | @@ -93,13 +93,13 @@ gpa: Allocator, |
| 93 | diagnostics: Diagnostics, | 93 | diagnostics: Diagnostics, |
| 94 | 94 | ||
| 95 | environment: Environment = .{}, | 95 | environment: Environment = .{}, |
| 96 | sources: std.StringArrayHashMapUnmanaged(Source) = .{}, | 96 | sources: std.StringArrayHashMapUnmanaged(Source) = .empty, |
| 97 | include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, | 97 | include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 98 | system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, | 98 | system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 99 | target: std.Target = @import("builtin").target, | 99 | target: std.Target = @import("builtin").target, |
| 100 | pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{}, | 100 | pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty, |
| 101 | langopts: LangOpts = .{}, | 101 | langopts: LangOpts = .{}, |
| 102 | generated_buf: std.ArrayListUnmanaged(u8) = .{}, | 102 | generated_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 103 | builtins: Builtins = .{}, | 103 | builtins: Builtins = .{}, |
| 104 | types: struct { | 104 | types: struct { |
| 105 | wchar: Type = undefined, | 105 | wchar: Type = undefined, |
lib/compiler/aro/aro/Diagnostics.zig+1-1| ... | @@ -221,7 +221,7 @@ pub const Options = struct { | ... | @@ -221,7 +221,7 @@ pub const Options = struct { |
| 221 | 221 | ||
| 222 | const Diagnostics = @This(); | 222 | const Diagnostics = @This(); |
| 223 | 223 | ||
| 224 | list: std.ArrayListUnmanaged(Message) = .{}, | 224 | list: std.ArrayListUnmanaged(Message) = .empty, |
| 225 | arena: std.heap.ArenaAllocator, | 225 | arena: std.heap.ArenaAllocator, |
| 226 | fatal_errors: bool = false, | 226 | fatal_errors: bool = false, |
| 227 | options: Options = .{}, | 227 | options: Options = .{}, |
lib/compiler/aro/aro/Driver.zig+2-2| ... | @@ -25,8 +25,8 @@ pub const Linker = enum { | ... | @@ -25,8 +25,8 @@ pub const Linker = enum { |
| 25 | const Driver = @This(); | 25 | const Driver = @This(); |
| 26 | 26 | ||
| 27 | comp: *Compilation, | 27 | comp: *Compilation, |
| 28 | inputs: std.ArrayListUnmanaged(Source) = .{}, | 28 | inputs: std.ArrayListUnmanaged(Source) = .empty, |
| 29 | link_objects: std.ArrayListUnmanaged([]const u8) = .{}, | 29 | link_objects: std.ArrayListUnmanaged([]const u8) = .empty, |
| 30 | output_name: ?[]const u8 = null, | 30 | output_name: ?[]const u8 = null, |
| 31 | sysroot: ?[]const u8 = null, | 31 | sysroot: ?[]const u8 = null, |
| 32 | system_defines: Compilation.SystemDefinesMode = .include_system_defines, | 32 | system_defines: Compilation.SystemDefinesMode = .include_system_defines, |
lib/compiler/aro/aro/Hideset.zig+2-2| ... | @@ -51,10 +51,10 @@ pub const Index = enum(u32) { | ... | @@ -51,10 +51,10 @@ pub const Index = enum(u32) { |
| 51 | _, | 51 | _, |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | map: std.AutoHashMapUnmanaged(Identifier, Index) = .{}, | 54 | map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty, |
| 55 | /// Used for computing union/intersection of two lists; stored here so that allocations can be retained | 55 | /// Used for computing union/intersection of two lists; stored here so that allocations can be retained |
| 56 | /// until hideset is deinit'ed | 56 | /// until hideset is deinit'ed |
| 57 | tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{}, | 57 | tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty, |
| 58 | linked_list: Item.List = .{}, | 58 | linked_list: Item.List = .{}, |
| 59 | comp: *const Compilation, | 59 | comp: *const Compilation, |
| 60 | 60 |
lib/compiler/aro/aro/InitList.zig+1-1| ... | @@ -23,7 +23,7 @@ const Item = struct { | ... | @@ -23,7 +23,7 @@ const Item = struct { |
| 23 | 23 | ||
| 24 | const InitList = @This(); | 24 | const InitList = @This(); |
| 25 | 25 | ||
| 26 | list: std.ArrayListUnmanaged(Item) = .{}, | 26 | list: std.ArrayListUnmanaged(Item) = .empty, |
| 27 | node: NodeIndex = .none, | 27 | node: NodeIndex = .none, |
| 28 | tok: TokenIndex = 0, | 28 | tok: TokenIndex = 0, |
| 29 | 29 |
lib/compiler/aro/aro/Parser.zig+3-3| ... | @@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param), | ... | @@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param), |
| 109 | enum_buf: std.ArrayList(Type.Enum.Field), | 109 | enum_buf: std.ArrayList(Type.Enum.Field), |
| 110 | record_buf: std.ArrayList(Type.Record.Field), | 110 | record_buf: std.ArrayList(Type.Record.Field), |
| 111 | attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, | 111 | attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, |
| 112 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{}, | 112 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty, |
| 113 | field_attr_buf: std.ArrayList([]const Attribute), | 113 | field_attr_buf: std.ArrayList([]const Attribute), |
| 114 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) | 114 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) |
| 115 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. | 115 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. |
| ... | @@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute), | ... | @@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute), |
| 117 | /// Items are removed if the type is subsequently completed with a definition. | 117 | /// Items are removed if the type is subsequently completed with a definition. |
| 118 | /// We only store the first tentative definition that uses a given type because this map is only used | 118 | /// We only store the first tentative definition that uses a given type because this map is only used |
| 119 | /// for issuing an error message, and correcting the first error for a type will fix all of them for that type. | 119 | /// for issuing an error message, and correcting the first error for a type will fix all of them for that type. |
| 120 | tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{}, | 120 | tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty, |
| 121 | 121 | ||
| 122 | // configuration and miscellaneous info | 122 | // configuration and miscellaneous info |
| 123 | no_eval: bool = false, | 123 | no_eval: bool = false, |
| ... | @@ -174,7 +174,7 @@ record: struct { | ... | @@ -174,7 +174,7 @@ record: struct { |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | } = .{}, | 176 | } = .{}, |
| 177 | record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{}, | 177 | record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty, |
| 178 | @"switch": ?*Switch = null, | 178 | @"switch": ?*Switch = null, |
| 179 | in_loop: bool = false, | 179 | in_loop: bool = false, |
| 180 | pragma_pack: ?u8 = null, | 180 | pragma_pack: ?u8 = null, |
lib/compiler/aro/aro/Preprocessor.zig+1-1| ... | @@ -95,7 +95,7 @@ counter: u32 = 0, | ... | @@ -95,7 +95,7 @@ counter: u32 = 0, |
| 95 | expansion_source_loc: Source.Location = undefined, | 95 | expansion_source_loc: Source.Location = undefined, |
| 96 | poisoned_identifiers: std.StringHashMap(void), | 96 | poisoned_identifiers: std.StringHashMap(void), |
| 97 | /// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any | 97 | /// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any |
| 98 | include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{}, | 98 | include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty, |
| 99 | 99 | ||
| 100 | /// Store `keyword_define` and `keyword_undef` tokens. | 100 | /// Store `keyword_define` and `keyword_undef` tokens. |
| 101 | /// Used to implement preprocessor debug dump options | 101 | /// Used to implement preprocessor debug dump options |
lib/compiler/aro/aro/SymbolStack.zig+3-3| ... | @@ -33,14 +33,14 @@ pub const Kind = enum { | ... | @@ -33,14 +33,14 @@ pub const Kind = enum { |
| 33 | constexpr, | 33 | constexpr, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | scopes: std.ArrayListUnmanaged(Scope) = .{}, | 36 | scopes: std.ArrayListUnmanaged(Scope) = .empty, |
| 37 | /// allocations from nested scopes are retained after popping; `active_len` is the number | 37 | /// allocations from nested scopes are retained after popping; `active_len` is the number |
| 38 | /// of currently-active items in `scopes`. | 38 | /// of currently-active items in `scopes`. |
| 39 | active_len: usize = 0, | 39 | active_len: usize = 0, |
| 40 | 40 | ||
| 41 | const Scope = struct { | 41 | const Scope = struct { |
| 42 | vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{}, | 42 | vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty, |
| 43 | tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{}, | 43 | tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty, |
| 44 | 44 | ||
| 45 | fn deinit(self: *Scope, allocator: Allocator) void { | 45 | fn deinit(self: *Scope, allocator: Allocator) void { |
| 46 | self.vars.deinit(allocator); | 46 | self.vars.deinit(allocator); |
lib/compiler/aro/aro/pragmas/gcc.zig+1-1| ... | @@ -19,7 +19,7 @@ pragma: Pragma = .{ | ... | @@ -19,7 +19,7 @@ pragma: Pragma = .{ |
| 19 | .preserveTokens = preserveTokens, | 19 | .preserveTokens = preserveTokens, |
| 20 | }, | 20 | }, |
| 21 | original_options: Diagnostics.Options = .{}, | 21 | original_options: Diagnostics.Options = .{}, |
| 22 | options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{}, | 22 | options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .empty, |
| 23 | 23 | ||
| 24 | const Directive = enum { | 24 | const Directive = enum { |
| 25 | warning, | 25 | warning, |
lib/compiler/aro/aro/pragmas/pack.zig+1-1| ... | @@ -15,7 +15,7 @@ pragma: Pragma = .{ | ... | @@ -15,7 +15,7 @@ pragma: Pragma = .{ |
| 15 | .parserHandler = parserHandler, | 15 | .parserHandler = parserHandler, |
| 16 | .preserveTokens = preserveTokens, | 16 | .preserveTokens = preserveTokens, |
| 17 | }, | 17 | }, |
| 18 | stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{}, | 18 | stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .empty, |
| 19 | 19 | ||
| 20 | pub fn init(allocator: mem.Allocator) !*Pragma { | 20 | pub fn init(allocator: mem.Allocator) !*Pragma { |
| 21 | var pack = try allocator.create(Pack); | 21 | 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"); | ... | @@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults"); |
| 11 | const Linux = @This(); | 11 | const Linux = @This(); |
| 12 | 12 | ||
| 13 | distro: Distro.Tag = .unknown, | 13 | distro: Distro.Tag = .unknown, |
| 14 | extra_opts: std.ArrayListUnmanaged([]const u8) = .{}, | 14 | extra_opts: std.ArrayListUnmanaged([]const u8) = .empty, |
| 15 | gcc_detector: GCCDetector = .{}, | 15 | gcc_detector: GCCDetector = .{}, |
| 16 | 16 | ||
| 17 | pub fn discover(self: *Linux, tc: *Toolchain) !void { | 17 | pub 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; | ... | @@ -8,14 +8,14 @@ const Limb = std.math.big.Limb; |
| 8 | 8 | ||
| 9 | const Interner = @This(); | 9 | const Interner = @This(); |
| 10 | 10 | ||
| 11 | map: std.AutoArrayHashMapUnmanaged(void, void) = .{}, | 11 | map: std.AutoArrayHashMapUnmanaged(void, void) = .empty, |
| 12 | items: std.MultiArrayList(struct { | 12 | items: std.MultiArrayList(struct { |
| 13 | tag: Tag, | 13 | tag: Tag, |
| 14 | data: u32, | 14 | data: u32, |
| 15 | }) = .{}, | 15 | }) = .{}, |
| 16 | extra: std.ArrayListUnmanaged(u32) = .{}, | 16 | extra: std.ArrayListUnmanaged(u32) = .empty, |
| 17 | limbs: std.ArrayListUnmanaged(Limb) = .{}, | 17 | limbs: std.ArrayListUnmanaged(Limb) = .empty, |
| 18 | strings: std.ArrayListUnmanaged(u8) = .{}, | 18 | strings: std.ArrayListUnmanaged(u8) = .empty, |
| 19 | 19 | ||
| 20 | const KeyAdapter = struct { | 20 | const KeyAdapter = struct { |
| 21 | interner: *const Interner, | 21 | interner: *const Interner, |
lib/compiler/aro/backend/Ir.zig+2-2| ... | @@ -26,9 +26,9 @@ pub const Builder = struct { | ... | @@ -26,9 +26,9 @@ pub const Builder = struct { |
| 26 | arena: std.heap.ArenaAllocator, | 26 | arena: std.heap.ArenaAllocator, |
| 27 | interner: *Interner, | 27 | interner: *Interner, |
| 28 | 28 | ||
| 29 | decls: std.StringArrayHashMapUnmanaged(Decl) = .{}, | 29 | decls: std.StringArrayHashMapUnmanaged(Decl) = .empty, |
| 30 | instructions: std.MultiArrayList(Ir.Inst) = .{}, | 30 | instructions: std.MultiArrayList(Ir.Inst) = .{}, |
| 31 | body: std.ArrayListUnmanaged(Ref) = .{}, | 31 | body: std.ArrayListUnmanaged(Ref) = .empty, |
| 32 | alloc_count: u32 = 0, | 32 | alloc_count: u32 = 0, |
| 33 | arg_count: u32 = 0, | 33 | arg_count: u32 = 0, |
| 34 | current_label: Ref = undefined, | 34 | current_label: Ref = undefined, |
lib/compiler/aro/backend/Object/Elf.zig+4-4| ... | @@ -5,7 +5,7 @@ const Object = @import("../Object.zig"); | ... | @@ -5,7 +5,7 @@ const Object = @import("../Object.zig"); |
| 5 | 5 | ||
| 6 | const Section = struct { | 6 | const Section = struct { |
| 7 | data: std.ArrayList(u8), | 7 | data: std.ArrayList(u8), |
| 8 | relocations: std.ArrayListUnmanaged(Relocation) = .{}, | 8 | relocations: std.ArrayListUnmanaged(Relocation) = .empty, |
| 9 | flags: u64, | 9 | flags: u64, |
| 10 | type: u32, | 10 | type: u32, |
| 11 | index: u16 = undefined, | 11 | index: u16 = undefined, |
| ... | @@ -37,9 +37,9 @@ const Elf = @This(); | ... | @@ -37,9 +37,9 @@ const Elf = @This(); |
| 37 | 37 | ||
| 38 | obj: Object, | 38 | obj: Object, |
| 39 | /// The keys are owned by the Codegen.tree | 39 | /// The keys are owned by the Codegen.tree |
| 40 | sections: std.StringHashMapUnmanaged(*Section) = .{}, | 40 | sections: std.StringHashMapUnmanaged(*Section) = .empty, |
| 41 | local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | 41 | local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, |
| 42 | global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | 42 | global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty, |
| 43 | unnamed_symbol_mangle: u32 = 0, | 43 | unnamed_symbol_mangle: u32 = 0, |
| 44 | strtab_len: u64 = strtab_default.len, | 44 | strtab_len: u64 = strtab_default.len, |
| 45 | arena: std.heap.ArenaAllocator, | 45 | arena: std.heap.ArenaAllocator, |
lib/compiler/aro_translate_c.zig+8-8| ... | @@ -16,22 +16,22 @@ const Context = @This(); | ... | @@ -16,22 +16,22 @@ const Context = @This(); |
| 16 | 16 | ||
| 17 | gpa: mem.Allocator, | 17 | gpa: mem.Allocator, |
| 18 | arena: mem.Allocator, | 18 | arena: mem.Allocator, |
| 19 | decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{}, | 19 | decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty, |
| 20 | alias_list: AliasList, | 20 | alias_list: AliasList, |
| 21 | global_scope: *Scope.Root, | 21 | global_scope: *Scope.Root, |
| 22 | mangle_count: u32 = 0, | 22 | mangle_count: u32 = 0, |
| 23 | /// Table of record decls that have been demoted to opaques. | 23 | /// Table of record decls that have been demoted to opaques. |
| 24 | opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{}, | 24 | opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty, |
| 25 | /// Table of unnamed enums and records that are child types of typedefs. | 25 | /// Table of unnamed enums and records that are child types of typedefs. |
| 26 | unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{}, | 26 | unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty, |
| 27 | /// Needed to decide if we are parsing a typename | 27 | /// Needed to decide if we are parsing a typename |
| 28 | typedefs: std.StringArrayHashMapUnmanaged(void) = .{}, | 28 | typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 29 | 29 | ||
| 30 | /// This one is different than the root scope's name table. This contains | 30 | /// This one is different than the root scope's name table. This contains |
| 31 | /// a list of names that we found by visiting all the top level decls without | 31 | /// a list of names that we found by visiting all the top level decls without |
| 32 | /// translating them. The other maps are updated as we translate; this one is updated | 32 | /// translating them. The other maps are updated as we translate; this one is updated |
| 33 | /// up front in a pre-processing step. | 33 | /// up front in a pre-processing step. |
| 34 | global_names: std.StringArrayHashMapUnmanaged(void) = .{}, | 34 | global_names: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 35 | 35 | ||
| 36 | /// This is similar to `global_names`, but contains names which we would | 36 | /// This is similar to `global_names`, but contains names which we would |
| 37 | /// *like* to use, but do not strictly *have* to if they are unavailable. | 37 | /// *like* to use, but do not strictly *have* to if they are unavailable. |
| ... | @@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{}, | ... | @@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{}, |
| 40 | /// may be mangled. | 40 | /// may be mangled. |
| 41 | /// This is distinct from `global_names` so we can detect at a type | 41 | /// This is distinct from `global_names` so we can detect at a type |
| 42 | /// declaration whether or not the name is available. | 42 | /// declaration whether or not the name is available. |
| 43 | weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{}, | 43 | weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 44 | 44 | ||
| 45 | pattern_list: PatternList, | 45 | pattern_list: PatternList, |
| 46 | tree: Tree, | 46 | tree: Tree, |
| ... | @@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_ | ... | @@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_ |
| 697 | } | 697 | } |
| 698 | 698 | ||
| 699 | fn getTypeStr(c: *Context, ty: Type) ![]const u8 { | 699 | fn getTypeStr(c: *Context, ty: Type) ![]const u8 { |
| 700 | var buf: std.ArrayListUnmanaged(u8) = .{}; | 700 | var buf: std.ArrayListUnmanaged(u8) = .empty; |
| 701 | defer buf.deinit(c.gpa); | 701 | defer buf.deinit(c.gpa); |
| 702 | const w = buf.writer(c.gpa); | 702 | const w = buf.writer(c.gpa); |
| 703 | try ty.print(c.mapper, c.comp.langopts, w); | 703 | try ty.print(c.mapper, c.comp.langopts, w); |
| ... | @@ -1793,7 +1793,7 @@ pub fn main() !void { | ... | @@ -1793,7 +1793,7 @@ pub fn main() !void { |
| 1793 | defer arena_instance.deinit(); | 1793 | defer arena_instance.deinit(); |
| 1794 | const arena = arena_instance.allocator(); | 1794 | const arena = arena_instance.allocator(); |
| 1795 | 1795 | ||
| 1796 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 1796 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 1797 | const gpa = general_purpose_allocator.allocator(); | 1797 | const gpa = general_purpose_allocator.allocator(); |
| 1798 | 1798 | ||
| 1799 | const args = try std.process.argsAlloc(arena); | 1799 | const args = try std.process.argsAlloc(arena); |
lib/compiler/aro_translate_c/ast.zig+1-1| ... | @@ -808,7 +808,7 @@ const Context = struct { | ... | @@ -808,7 +808,7 @@ const Context = struct { |
| 808 | gpa: Allocator, | 808 | gpa: Allocator, |
| 809 | buf: std.ArrayList(u8), | 809 | buf: std.ArrayList(u8), |
| 810 | nodes: std.zig.Ast.NodeList = .{}, | 810 | 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, |
| 812 | tokens: std.zig.Ast.TokenList = .{}, | 812 | tokens: std.zig.Ast.TokenList = .{}, |
| 813 | 813 | ||
| 814 | fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex { | 814 | 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 { | ... | @@ -336,7 +336,7 @@ pub fn main() !void { |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | if (graph.needed_lazy_dependencies.entries.len != 0) { | 338 | if (graph.needed_lazy_dependencies.entries.len != 0) { |
| 339 | var buffer: std.ArrayListUnmanaged(u8) = .{}; | 339 | var buffer: std.ArrayListUnmanaged(u8) = .empty; |
| 340 | for (graph.needed_lazy_dependencies.keys()) |k| { | 340 | for (graph.needed_lazy_dependencies.keys()) |k| { |
| 341 | try buffer.appendSlice(arena, k); | 341 | try buffer.appendSlice(arena, k); |
| 342 | try buffer.append(arena, '\n'); | 342 | try buffer.append(arena, '\n'); |
| ... | @@ -1173,7 +1173,7 @@ pub fn printErrorMessages( | ... | @@ -1173,7 +1173,7 @@ pub fn printErrorMessages( |
| 1173 | // Provide context for where these error messages are coming from by | 1173 | // Provide context for where these error messages are coming from by |
| 1174 | // printing the corresponding Step subtree. | 1174 | // printing the corresponding Step subtree. |
| 1175 | 1175 | ||
| 1176 | var step_stack: std.ArrayListUnmanaged(*Step) = .{}; | 1176 | var step_stack: std.ArrayListUnmanaged(*Step) = .empty; |
| 1177 | defer step_stack.deinit(gpa); | 1177 | defer step_stack.deinit(gpa); |
| 1178 | try step_stack.append(gpa, failing_step); | 1178 | try step_stack.append(gpa, failing_step); |
| 1179 | while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) { | 1179 | 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 { | ... | @@ -15,7 +15,7 @@ pub fn main() !void { |
| 15 | defer arena_instance.deinit(); | 15 | defer arena_instance.deinit(); |
| 16 | const arena = arena_instance.allocator(); | 16 | const arena = arena_instance.allocator(); |
| 17 | 17 | ||
| 18 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 18 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 19 | const gpa = general_purpose_allocator.allocator(); | 19 | const gpa = general_purpose_allocator.allocator(); |
| 20 | 20 | ||
| 21 | const args = try std.process.argsAlloc(arena); | 21 | const args = try std.process.argsAlloc(arena); |
lib/compiler/reduce.zig+2-2| ... | @@ -51,7 +51,7 @@ pub fn main() !void { | ... | @@ -51,7 +51,7 @@ pub fn main() !void { |
| 51 | defer arena_instance.deinit(); | 51 | defer arena_instance.deinit(); |
| 52 | const arena = arena_instance.allocator(); | 52 | const arena = arena_instance.allocator(); |
| 53 | 53 | ||
| 54 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 54 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 55 | const gpa = general_purpose_allocator.allocator(); | 55 | const gpa = general_purpose_allocator.allocator(); |
| 56 | 56 | ||
| 57 | const args = try std.process.argsAlloc(arena); | 57 | const args = try std.process.argsAlloc(arena); |
| ... | @@ -109,7 +109,7 @@ pub fn main() !void { | ... | @@ -109,7 +109,7 @@ pub fn main() !void { |
| 109 | const root_source_file_path = opt_root_source_file_path orelse | 109 | const root_source_file_path = opt_root_source_file_path orelse |
| 110 | fatal("missing root source file path argument; see -h for usage", .{}); | 110 | fatal("missing root source file path argument; see -h for usage", .{}); |
| 111 | 111 | ||
| 112 | var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .{}; | 112 | var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 113 | try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1); | 113 | try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1); |
| 114 | interestingness_argv.appendAssumeCapacity(checker_path); | 114 | interestingness_argv.appendAssumeCapacity(checker_path); |
| 115 | interestingness_argv.appendSliceAssumeCapacity(argv); | 115 | interestingness_argv.appendSliceAssumeCapacity(argv); |
lib/compiler/resinator/ast.zig+1-1| ... | @@ -28,7 +28,7 @@ pub const Tree = struct { | ... | @@ -28,7 +28,7 @@ pub const Tree = struct { |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | pub const CodePageLookup = struct { | 30 | pub const CodePageLookup = struct { |
| 31 | lookup: std.ArrayListUnmanaged(CodePage) = .{}, | 31 | lookup: std.ArrayListUnmanaged(CodePage) = .empty, |
| 32 | allocator: Allocator, | 32 | allocator: Allocator, |
| 33 | default_code_page: CodePage, | 33 | default_code_page: CodePage, |
| 34 | 34 |
lib/compiler/resinator/cli.zig+4-4| ... | @@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void { | ... | @@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void { |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | pub const Diagnostics = struct { | 72 | pub const Diagnostics = struct { |
| 73 | errors: std.ArrayListUnmanaged(ErrorDetails) = .{}, | 73 | errors: std.ArrayListUnmanaged(ErrorDetails) = .empty, |
| 74 | allocator: Allocator, | 74 | allocator: Allocator, |
| 75 | 75 | ||
| 76 | pub const ErrorDetails = struct { | 76 | pub const ErrorDetails = struct { |
| 77 | arg_index: usize, | 77 | arg_index: usize, |
| 78 | arg_span: ArgSpan = .{}, | 78 | arg_span: ArgSpan = .{}, |
| 79 | msg: std.ArrayListUnmanaged(u8) = .{}, | 79 | msg: std.ArrayListUnmanaged(u8) = .empty, |
| 80 | type: Type = .err, | 80 | type: Type = .err, |
| 81 | print_args: bool = true, | 81 | print_args: bool = true, |
| 82 | 82 | ||
| ... | @@ -132,13 +132,13 @@ pub const Options = struct { | ... | @@ -132,13 +132,13 @@ pub const Options = struct { |
| 132 | allocator: Allocator, | 132 | allocator: Allocator, |
| 133 | input_filename: []const u8 = &[_]u8{}, | 133 | input_filename: []const u8 = &[_]u8{}, |
| 134 | output_filename: []const u8 = &[_]u8{}, | 134 | output_filename: []const u8 = &[_]u8{}, |
| 135 | extra_include_paths: std.ArrayListUnmanaged([]const u8) = .{}, | 135 | extra_include_paths: std.ArrayListUnmanaged([]const u8) = .empty, |
| 136 | ignore_include_env_var: bool = false, | 136 | ignore_include_env_var: bool = false, |
| 137 | preprocess: Preprocess = .yes, | 137 | preprocess: Preprocess = .yes, |
| 138 | default_language_id: ?u16 = null, | 138 | default_language_id: ?u16 = null, |
| 139 | default_code_page: ?CodePage = null, | 139 | default_code_page: ?CodePage = null, |
| 140 | verbose: bool = false, | 140 | verbose: bool = false, |
| 141 | symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .{}, | 141 | symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty, |
| 142 | null_terminate_string_table_strings: bool = false, | 142 | null_terminate_string_table_strings: bool = false, |
| 143 | max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints, | 143 | max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints, |
| 144 | silent_duplicate_control_ids: bool = false, | 144 | silent_duplicate_control_ids: bool = false, |
lib/compiler/resinator/compile.zig+5-5| ... | @@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" { | ... | @@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" { |
| 3004 | } | 3004 | } |
| 3005 | 3005 | ||
| 3006 | pub const FontDir = struct { | 3006 | pub const FontDir = struct { |
| 3007 | fonts: std.ArrayListUnmanaged(Font) = .{}, | 3007 | fonts: std.ArrayListUnmanaged(Font) = .empty, |
| 3008 | /// To keep track of which ids are set and where they were set from | 3008 | /// 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, |
| 3010 | 3010 | ||
| 3011 | pub const Font = struct { | 3011 | pub const Font = struct { |
| 3012 | id: u16, | 3012 | id: u16, |
| ... | @@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct { | ... | @@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct { |
| 3112 | /// when the first STRINGTABLE for the language was defined, and all blocks for a given | 3112 | /// when the first STRINGTABLE for the language was defined, and all blocks for a given |
| 3113 | /// language are written contiguously. | 3113 | /// language are written contiguously. |
| 3114 | /// Using an ArrayHashMap here gives us this property for free. | 3114 | /// 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, |
| 3116 | 3116 | ||
| 3117 | pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void { | 3117 | pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void { |
| 3118 | self.tables.deinit(allocator); | 3118 | self.tables.deinit(allocator); |
| ... | @@ -3143,10 +3143,10 @@ pub const StringTable = struct { | ... | @@ -3143,10 +3143,10 @@ pub const StringTable = struct { |
| 3143 | /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written | 3143 | /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written |
| 3144 | /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second). | 3144 | /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second). |
| 3145 | /// Using an ArrayHashMap here gives us this property for free. | 3145 | /// Using an ArrayHashMap here gives us this property for free. |
| 3146 | blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .{}, | 3146 | blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .empty, |
| 3147 | 3147 | ||
| 3148 | pub const Block = struct { | 3148 | pub const Block = struct { |
| 3149 | strings: std.ArrayListUnmanaged(Token) = .{}, | 3149 | strings: std.ArrayListUnmanaged(Token) = .empty, |
| 3150 | set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 }, | 3150 | set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 }, |
| 3151 | memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING), | 3151 | memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING), |
| 3152 | characteristics: u32, | 3152 | characteristics: u32, |
lib/compiler/resinator/errors.zig+3-3| ... | @@ -13,10 +13,10 @@ const builtin = @import("builtin"); | ... | @@ -13,10 +13,10 @@ const builtin = @import("builtin"); |
| 13 | const native_endian = builtin.cpu.arch.endian(); | 13 | const native_endian = builtin.cpu.arch.endian(); |
| 14 | 14 | ||
| 15 | pub const Diagnostics = struct { | 15 | pub const Diagnostics = struct { |
| 16 | errors: std.ArrayListUnmanaged(ErrorDetails) = .{}, | 16 | errors: std.ArrayListUnmanaged(ErrorDetails) = .empty, |
| 17 | /// Append-only, cannot handle removing strings. | 17 | /// Append-only, cannot handle removing strings. |
| 18 | /// Expects to own all strings within the list. | 18 | /// Expects to own all strings within the list. |
| 19 | strings: std.ArrayListUnmanaged([]const u8) = .{}, | 19 | strings: std.ArrayListUnmanaged([]const u8) = .empty, |
| 20 | allocator: std.mem.Allocator, | 20 | allocator: std.mem.Allocator, |
| 21 | 21 | ||
| 22 | pub fn init(allocator: std.mem.Allocator) Diagnostics { | 22 | pub fn init(allocator: std.mem.Allocator) Diagnostics { |
| ... | @@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con | ... | @@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con |
| 968 | const CorrespondingLines = struct { | 968 | const CorrespondingLines = struct { |
| 969 | worth_printing_note: bool = true, | 969 | worth_printing_note: bool = true, |
| 970 | worth_printing_lines: bool = true, | 970 | worth_printing_lines: bool = true, |
| 971 | lines: std.ArrayListUnmanaged(u8) = .{}, | 971 | lines: std.ArrayListUnmanaged(u8) = .empty, |
| 972 | lines_is_error_message: bool = false, | 972 | lines_is_error_message: bool = false, |
| 973 | 973 | ||
| 974 | 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 { | 974 | 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; | ... | @@ -10,7 +10,7 @@ const renderErrorMessage = @import("utils.zig").renderErrorMessage; |
| 10 | const aro = @import("aro"); | 10 | const aro = @import("aro"); |
| 11 | 11 | ||
| 12 | pub fn main() !void { | 12 | pub fn main() !void { |
| 13 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 13 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 14 | defer std.debug.assert(gpa.deinit() == .ok); | 14 | defer std.debug.assert(gpa.deinit() == .ok); |
| 15 | const allocator = gpa.allocator(); | 15 | const allocator = gpa.allocator(); |
| 16 | 16 | ||
| ... | @@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle( | ... | @@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle( |
| 432 | }); | 432 | }); |
| 433 | 433 | ||
| 434 | var cur_err: ?ErrorBundle.ErrorMessage = null; | 434 | var cur_err: ?ErrorBundle.ErrorMessage = null; |
| 435 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; | 435 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; |
| 436 | defer cur_notes.deinit(gpa); | 436 | defer cur_notes.deinit(gpa); |
| 437 | for (diagnostics.errors.items) |err_details| { | 437 | for (diagnostics.errors.items) |err_details| { |
| 438 | switch (err_details.type) { | 438 | switch (err_details.type) { |
| ... | @@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle( | ... | @@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle( |
| 474 | try bundle.init(gpa); | 474 | try bundle.init(gpa); |
| 475 | errdefer bundle.deinit(); | 475 | errdefer bundle.deinit(); |
| 476 | 476 | ||
| 477 | var msg_buf: std.ArrayListUnmanaged(u8) = .{}; | 477 | var msg_buf: std.ArrayListUnmanaged(u8) = .empty; |
| 478 | defer msg_buf.deinit(gpa); | 478 | defer msg_buf.deinit(gpa); |
| 479 | var cur_err: ?ErrorBundle.ErrorMessage = null; | 479 | var cur_err: ?ErrorBundle.ErrorMessage = null; |
| 480 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; | 480 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; |
| 481 | defer cur_notes.deinit(gpa); | 481 | defer cur_notes.deinit(gpa); |
| 482 | for (diagnostics.errors.items) |err_details| { | 482 | for (diagnostics.errors.items) |err_details| { |
| 483 | switch (err_details.type) { | 483 | switch (err_details.type) { |
| ... | @@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle( | ... | @@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle( |
| 587 | var msg_writer = MsgWriter.init(gpa); | 587 | var msg_writer = MsgWriter.init(gpa); |
| 588 | defer msg_writer.deinit(); | 588 | defer msg_writer.deinit(); |
| 589 | var cur_err: ?ErrorBundle.ErrorMessage = null; | 589 | var cur_err: ?ErrorBundle.ErrorMessage = null; |
| 590 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{}; | 590 | var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty; |
| 591 | defer cur_notes.deinit(gpa); | 591 | defer cur_notes.deinit(gpa); |
| 592 | for (comp.diagnostics.list.items) |msg| { | 592 | for (comp.diagnostics.list.items) |msg| { |
| 593 | switch (msg.kind) { | 593 | switch (msg.kind) { |
lib/compiler/resinator/parse.zig+15-15| ... | @@ -111,7 +111,7 @@ pub const Parser = struct { | ... | @@ -111,7 +111,7 @@ pub const Parser = struct { |
| 111 | /// current token is unchanged. | 111 | /// current token is unchanged. |
| 112 | /// The returned slice is allocated by the parser's arena | 112 | /// The returned slice is allocated by the parser's arena |
| 113 | fn parseCommonResourceAttributes(self: *Self) ![]Token { | 113 | fn parseCommonResourceAttributes(self: *Self) ![]Token { |
| 114 | var common_resource_attributes = std.ArrayListUnmanaged(Token){}; | 114 | var common_resource_attributes: std.ArrayListUnmanaged(Token) = .empty; |
| 115 | while (true) { | 115 | while (true) { |
| 116 | const maybe_common_resource_attribute = try self.lookaheadToken(.normal); | 116 | const maybe_common_resource_attribute = try self.lookaheadToken(.normal); |
| 117 | if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) { | 117 | 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 { | ... | @@ -131,7 +131,7 @@ pub const Parser = struct { |
| 131 | /// current token is unchanged. | 131 | /// current token is unchanged. |
| 132 | /// The returned slice is allocated by the parser's arena | 132 | /// The returned slice is allocated by the parser's arena |
| 133 | fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node { | 133 | fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node { |
| 134 | var optional_statements = std.ArrayListUnmanaged(*Node){}; | 134 | var optional_statements: std.ArrayListUnmanaged(*Node) = .empty; |
| 135 | while (true) { | 135 | while (true) { |
| 136 | const lookahead_token = try self.lookaheadToken(.normal); | 136 | const lookahead_token = try self.lookaheadToken(.normal); |
| 137 | if (lookahead_token.id != .literal) break; | 137 | if (lookahead_token.id != .literal) break; |
| ... | @@ -445,7 +445,7 @@ pub const Parser = struct { | ... | @@ -445,7 +445,7 @@ pub const Parser = struct { |
| 445 | const begin_token = self.state.token; | 445 | const begin_token = self.state.token; |
| 446 | try self.check(.begin); | 446 | try self.check(.begin); |
| 447 | 447 | ||
| 448 | var accelerators = std.ArrayListUnmanaged(*Node){}; | 448 | var accelerators: std.ArrayListUnmanaged(*Node) = .empty; |
| 449 | 449 | ||
| 450 | while (true) { | 450 | while (true) { |
| 451 | const lookahead = try self.lookaheadToken(.normal); | 451 | const lookahead = try self.lookaheadToken(.normal); |
| ... | @@ -463,7 +463,7 @@ pub const Parser = struct { | ... | @@ -463,7 +463,7 @@ pub const Parser = struct { |
| 463 | 463 | ||
| 464 | const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } }); | 464 | const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } }); |
| 465 | 465 | ||
| 466 | var type_and_options = std.ArrayListUnmanaged(Token){}; | 466 | var type_and_options: std.ArrayListUnmanaged(Token) = .empty; |
| 467 | while (true) { | 467 | while (true) { |
| 468 | if (!(try self.parseOptionalToken(.comma))) break; | 468 | if (!(try self.parseOptionalToken(.comma))) break; |
| 469 | 469 | ||
| ... | @@ -528,7 +528,7 @@ pub const Parser = struct { | ... | @@ -528,7 +528,7 @@ pub const Parser = struct { |
| 528 | const begin_token = self.state.token; | 528 | const begin_token = self.state.token; |
| 529 | try self.check(.begin); | 529 | try self.check(.begin); |
| 530 | 530 | ||
| 531 | var controls = std.ArrayListUnmanaged(*Node){}; | 531 | var controls: std.ArrayListUnmanaged(*Node) = .empty; |
| 532 | defer controls.deinit(self.state.allocator); | 532 | defer controls.deinit(self.state.allocator); |
| 533 | while (try self.parseControlStatement(resource)) |control_node| { | 533 | while (try self.parseControlStatement(resource)) |control_node| { |
| 534 | // The number of controls must fit in a u16 in order for it to | 534 | // The number of controls must fit in a u16 in order for it to |
| ... | @@ -587,7 +587,7 @@ pub const Parser = struct { | ... | @@ -587,7 +587,7 @@ pub const Parser = struct { |
| 587 | const begin_token = self.state.token; | 587 | const begin_token = self.state.token; |
| 588 | try self.check(.begin); | 588 | try self.check(.begin); |
| 589 | 589 | ||
| 590 | var buttons = std.ArrayListUnmanaged(*Node){}; | 590 | var buttons: std.ArrayListUnmanaged(*Node) = .empty; |
| 591 | defer buttons.deinit(self.state.allocator); | 591 | defer buttons.deinit(self.state.allocator); |
| 592 | while (try self.parseToolbarButtonStatement()) |button_node| { | 592 | while (try self.parseToolbarButtonStatement()) |button_node| { |
| 593 | // The number of buttons must fit in a u16 in order for it to | 593 | // The number of buttons must fit in a u16 in order for it to |
| ... | @@ -645,7 +645,7 @@ pub const Parser = struct { | ... | @@ -645,7 +645,7 @@ pub const Parser = struct { |
| 645 | const begin_token = self.state.token; | 645 | const begin_token = self.state.token; |
| 646 | try self.check(.begin); | 646 | try self.check(.begin); |
| 647 | 647 | ||
| 648 | var items = std.ArrayListUnmanaged(*Node){}; | 648 | var items: std.ArrayListUnmanaged(*Node) = .empty; |
| 649 | defer items.deinit(self.state.allocator); | 649 | defer items.deinit(self.state.allocator); |
| 650 | while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| { | 650 | while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| { |
| 651 | try items.append(self.state.allocator, item_node); | 651 | try items.append(self.state.allocator, item_node); |
| ... | @@ -679,7 +679,7 @@ pub const Parser = struct { | ... | @@ -679,7 +679,7 @@ pub const Parser = struct { |
| 679 | // common resource attributes must all be contiguous and come before optional-statements | 679 | // common resource attributes must all be contiguous and come before optional-statements |
| 680 | const common_resource_attributes = try self.parseCommonResourceAttributes(); | 680 | const common_resource_attributes = try self.parseCommonResourceAttributes(); |
| 681 | 681 | ||
| 682 | var fixed_info = std.ArrayListUnmanaged(*Node){}; | 682 | var fixed_info: std.ArrayListUnmanaged(*Node) = .empty; |
| 683 | while (try self.parseVersionStatement()) |version_statement| { | 683 | while (try self.parseVersionStatement()) |version_statement| { |
| 684 | try fixed_info.append(self.state.arena, version_statement); | 684 | try fixed_info.append(self.state.arena, version_statement); |
| 685 | } | 685 | } |
| ... | @@ -688,7 +688,7 @@ pub const Parser = struct { | ... | @@ -688,7 +688,7 @@ pub const Parser = struct { |
| 688 | const begin_token = self.state.token; | 688 | const begin_token = self.state.token; |
| 689 | try self.check(.begin); | 689 | try self.check(.begin); |
| 690 | 690 | ||
| 691 | var block_statements = std.ArrayListUnmanaged(*Node){}; | 691 | var block_statements: std.ArrayListUnmanaged(*Node) = .empty; |
| 692 | while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| { | 692 | while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| { |
| 693 | try block_statements.append(self.state.arena, block_node); | 693 | try block_statements.append(self.state.arena, block_node); |
| 694 | } | 694 | } |
| ... | @@ -1064,7 +1064,7 @@ pub const Parser = struct { | ... | @@ -1064,7 +1064,7 @@ pub const Parser = struct { |
| 1064 | 1064 | ||
| 1065 | _ = try self.parseOptionalToken(.comma); | 1065 | _ = try self.parseOptionalToken(.comma); |
| 1066 | 1066 | ||
| 1067 | var options = std.ArrayListUnmanaged(Token){}; | 1067 | var options: std.ArrayListUnmanaged(Token) = .empty; |
| 1068 | while (true) { | 1068 | while (true) { |
| 1069 | const option_token = try self.lookaheadToken(.normal); | 1069 | const option_token = try self.lookaheadToken(.normal); |
| 1070 | if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { | 1070 | if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { |
| ... | @@ -1099,7 +1099,7 @@ pub const Parser = struct { | ... | @@ -1099,7 +1099,7 @@ pub const Parser = struct { |
| 1099 | } | 1099 | } |
| 1100 | try self.skipAnyCommas(); | 1100 | try self.skipAnyCommas(); |
| 1101 | 1101 | ||
| 1102 | var options = std.ArrayListUnmanaged(Token){}; | 1102 | var options: std.ArrayListUnmanaged(Token) = .empty; |
| 1103 | while (true) { | 1103 | while (true) { |
| 1104 | const option_token = try self.lookaheadToken(.normal); | 1104 | const option_token = try self.lookaheadToken(.normal); |
| 1105 | if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { | 1105 | if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) { |
| ... | @@ -1114,7 +1114,7 @@ pub const Parser = struct { | ... | @@ -1114,7 +1114,7 @@ pub const Parser = struct { |
| 1114 | const begin_token = self.state.token; | 1114 | const begin_token = self.state.token; |
| 1115 | try self.check(.begin); | 1115 | try self.check(.begin); |
| 1116 | 1116 | ||
| 1117 | var items = std.ArrayListUnmanaged(*Node){}; | 1117 | var items: std.ArrayListUnmanaged(*Node) = .empty; |
| 1118 | while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { | 1118 | while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { |
| 1119 | try items.append(self.state.arena, item_node); | 1119 | try items.append(self.state.arena, item_node); |
| 1120 | } | 1120 | } |
| ... | @@ -1184,7 +1184,7 @@ pub const Parser = struct { | ... | @@ -1184,7 +1184,7 @@ pub const Parser = struct { |
| 1184 | const begin_token = self.state.token; | 1184 | const begin_token = self.state.token; |
| 1185 | try self.check(.begin); | 1185 | try self.check(.begin); |
| 1186 | 1186 | ||
| 1187 | var items = std.ArrayListUnmanaged(*Node){}; | 1187 | var items: std.ArrayListUnmanaged(*Node) = .empty; |
| 1188 | while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { | 1188 | while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| { |
| 1189 | try items.append(self.state.arena, item_node); | 1189 | try items.append(self.state.arena, item_node); |
| 1190 | } | 1190 | } |
| ... | @@ -1341,7 +1341,7 @@ pub const Parser = struct { | ... | @@ -1341,7 +1341,7 @@ pub const Parser = struct { |
| 1341 | const begin_token = self.state.token; | 1341 | const begin_token = self.state.token; |
| 1342 | try self.check(.begin); | 1342 | try self.check(.begin); |
| 1343 | 1343 | ||
| 1344 | var children = std.ArrayListUnmanaged(*Node){}; | 1344 | var children: std.ArrayListUnmanaged(*Node) = .empty; |
| 1345 | while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| { | 1345 | while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| { |
| 1346 | try children.append(self.state.arena, value_node); | 1346 | try children.append(self.state.arena, value_node); |
| 1347 | } | 1347 | } |
| ... | @@ -1374,7 +1374,7 @@ pub const Parser = struct { | ... | @@ -1374,7 +1374,7 @@ pub const Parser = struct { |
| 1374 | } | 1374 | } |
| 1375 | 1375 | ||
| 1376 | fn parseBlockValuesList(self: *Self, had_comma_before_first_value: bool) Error![]*Node { | 1376 | 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; |
| 1378 | var seen_number: bool = false; | 1378 | var seen_number: bool = false; |
| 1379 | var first_string_value: ?*Node = null; | 1379 | var first_string_value: ?*Node = null; |
| 1380 | while (true) { | 1380 | while (true) { |
lib/compiler/resinator/source_mapping.zig+3-3| ... | @@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct { | ... | @@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct { |
| 10 | 10 | ||
| 11 | const CurrentMapping = struct { | 11 | const CurrentMapping = struct { |
| 12 | line_num: usize = 1, | 12 | line_num: usize = 1, |
| 13 | filename: std.ArrayListUnmanaged(u8) = .{}, | 13 | filename: std.ArrayListUnmanaged(u8) = .empty, |
| 14 | pending: bool = true, | 14 | pending: bool = true, |
| 15 | ignore_contents: bool = false, | 15 | ignore_contents: bool = false, |
| 16 | }; | 16 | }; |
| ... | @@ -626,8 +626,8 @@ test "SourceMappings collapse" { | ... | @@ -626,8 +626,8 @@ test "SourceMappings collapse" { |
| 626 | 626 | ||
| 627 | /// Same thing as StringTable in Zig's src/Wasm.zig | 627 | /// Same thing as StringTable in Zig's src/Wasm.zig |
| 628 | pub const StringTable = struct { | 628 | pub const StringTable = struct { |
| 629 | data: std.ArrayListUnmanaged(u8) = .{}, | 629 | data: std.ArrayListUnmanaged(u8) = .empty, |
| 630 | map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, | 630 | map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, |
| 631 | 631 | ||
| 632 | pub fn deinit(self: *StringTable, allocator: Allocator) void { | 632 | pub fn deinit(self: *StringTable, allocator: Allocator) void { |
| 633 | self.data.deinit(allocator); | 633 | self.data.deinit(allocator); |
lib/compiler/std-docs.zig+2-2| ... | @@ -25,7 +25,7 @@ pub fn main() !void { | ... | @@ -25,7 +25,7 @@ pub fn main() !void { |
| 25 | defer arena_instance.deinit(); | 25 | defer arena_instance.deinit(); |
| 26 | const arena = arena_instance.allocator(); | 26 | const arena = arena_instance.allocator(); |
| 27 | 27 | ||
| 28 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 28 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 29 | const gpa = general_purpose_allocator.allocator(); | 29 | const gpa = general_purpose_allocator.allocator(); |
| 30 | 30 | ||
| 31 | var argv = try std.process.argsWithAllocator(arena); | 31 | var argv = try std.process.argsWithAllocator(arena); |
| ... | @@ -265,7 +265,7 @@ fn buildWasmBinary( | ... | @@ -265,7 +265,7 @@ fn buildWasmBinary( |
| 265 | ) !Cache.Path { | 265 | ) !Cache.Path { |
| 266 | const gpa = context.gpa; | 266 | const gpa = context.gpa; |
| 267 | 267 | ||
| 268 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; | 268 | var argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 269 | 269 | ||
| 270 | try argv.appendSlice(arena, &.{ | 270 | try argv.appendSlice(arena, &.{ |
| 271 | context.zig_exe_path, // | 271 | context.zig_exe_path, // |
lib/compiler/test_runner.zig+1-1| ... | @@ -85,7 +85,7 @@ fn mainServer() !void { | ... | @@ -85,7 +85,7 @@ fn mainServer() !void { |
| 85 | @panic("internal test runner memory leak"); | 85 | @panic("internal test runner memory leak"); |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | var string_bytes: std.ArrayListUnmanaged(u8) = .{}; | 88 | var string_bytes: std.ArrayListUnmanaged(u8) = .empty; |
| 89 | defer string_bytes.deinit(testing.allocator); | 89 | defer string_bytes.deinit(testing.allocator); |
| 90 | try string_bytes.append(testing.allocator, 0); // Reserve 0 for null. | 90 | try string_bytes.append(testing.allocator, 0); // Reserve 0 for null. |
| 91 | 91 |
lib/docs/wasm/Walk.zig+10-10| ... | @@ -10,9 +10,9 @@ const Oom = error{OutOfMemory}; | ... | @@ -10,9 +10,9 @@ const Oom = error{OutOfMemory}; |
| 10 | 10 | ||
| 11 | pub const Decl = @import("Decl.zig"); | 11 | pub const Decl = @import("Decl.zig"); |
| 12 | 12 | ||
| 13 | pub var files: std.StringArrayHashMapUnmanaged(File) = .{}; | 13 | pub var files: std.StringArrayHashMapUnmanaged(File) = .empty; |
| 14 | pub var decls: std.ArrayListUnmanaged(Decl) = .{}; | 14 | pub var decls: std.ArrayListUnmanaged(Decl) = .empty; |
| 15 | pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .{}; | 15 | pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty; |
| 16 | 16 | ||
| 17 | file: File.Index, | 17 | file: File.Index, |
| 18 | 18 | ||
| ... | @@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) { | ... | @@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) { |
| 42 | pub const File = struct { | 42 | pub const File = struct { |
| 43 | ast: Ast, | 43 | ast: Ast, |
| 44 | /// Maps identifiers to the declarations they point to. | 44 | /// 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, |
| 46 | /// Maps field access identifiers to the containing field access node. | 46 | /// 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, |
| 48 | /// Maps declarations to their global index. | 48 | /// 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, |
| 50 | /// Maps function declarations to doctests. | 50 | /// 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, |
| 52 | /// root node => its namespace scope | 52 | /// root node => its namespace scope |
| 53 | /// struct/union/enum/opaque decl node => its namespace scope | 53 | /// struct/union/enum/opaque decl node => its namespace scope |
| 54 | /// local var decl node => its local variable scope | 54 | /// 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, |
| 56 | 56 | ||
| 57 | pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index { | 57 | pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index { |
| 58 | const decl_node = file.ident_decls.get(token) orelse return .none; | 58 | const decl_node = file.ident_decls.get(token) orelse return .none; |
| ... | @@ -464,8 +464,8 @@ pub const Scope = struct { | ... | @@ -464,8 +464,8 @@ pub const Scope = struct { |
| 464 | const Namespace = struct { | 464 | const Namespace = struct { |
| 465 | base: Scope = .{ .tag = .namespace }, | 465 | base: Scope = .{ .tag = .namespace }, |
| 466 | parent: *Scope, | 466 | parent: *Scope, |
| 467 | names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{}, | 467 | names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, |
| 468 | doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{}, | 468 | doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, |
| 469 | decl_index: Decl.Index, | 469 | decl_index: Decl.Index, |
| 470 | }; | 470 | }; |
| 471 | 471 |
lib/docs/wasm/html_render.zig+1-1| ... | @@ -38,7 +38,7 @@ pub fn fileSourceHtml( | ... | @@ -38,7 +38,7 @@ pub fn fileSourceHtml( |
| 38 | const file = file_index.get(); | 38 | const file = file_index.get(); |
| 39 | 39 | ||
| 40 | const g = struct { | 40 | const g = struct { |
| 41 | var field_access_buffer: std.ArrayListUnmanaged(u8) = .{}; | 41 | var field_access_buffer: std.ArrayListUnmanaged(u8) = .empty; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | const token_tags = ast.tokens.items(.tag); | 44 | 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 { | ... | @@ -60,8 +60,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void { |
| 60 | }; | 60 | }; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | var query_string: std.ArrayListUnmanaged(u8) = .{}; | 63 | var query_string: std.ArrayListUnmanaged(u8) = .empty; |
| 64 | var query_results: std.ArrayListUnmanaged(Decl.Index) = .{}; | 64 | var query_results: std.ArrayListUnmanaged(Decl.Index) = .empty; |
| 65 | 65 | ||
| 66 | /// Resizes the query string to be the correct length; returns the pointer to | 66 | /// Resizes the query string to be the correct length; returns the pointer to |
| 67 | /// the query string. | 67 | /// the query string. |
| ... | @@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void { | ... | @@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void { |
| 93 | segments: u16, | 93 | segments: u16, |
| 94 | }; | 94 | }; |
| 95 | const g = struct { | 95 | const g = struct { |
| 96 | var full_path_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) = .{}; | 97 | var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .empty; |
| 98 | var doc_search_text: std.ArrayListUnmanaged(u8) = .{}; | 98 | var doc_search_text: std.ArrayListUnmanaged(u8) = .empty; |
| 99 | /// Each element matches a corresponding query_results element. | 99 | /// Each element matches a corresponding query_results element. |
| 100 | var scores: std.ArrayListUnmanaged(Score) = .{}; | 100 | var scores: std.ArrayListUnmanaged(Score) = .empty; |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | // First element stores the size of the list. | 103 | // First element stores the size of the list. |
| ... | @@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) { | ... | @@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) { |
| 255 | } | 255 | } |
| 256 | }; | 256 | }; |
| 257 | 257 | ||
| 258 | var string_result: std.ArrayListUnmanaged(u8) = .{}; | 258 | var string_result: std.ArrayListUnmanaged(u8) = .empty; |
| 259 | var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .{}; | 259 | var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .empty; |
| 260 | 260 | ||
| 261 | export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) { | 261 | export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) { |
| 262 | return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM")); | 262 | 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) { | ... | @@ -381,7 +381,7 @@ export fn decl_params(decl_index: Decl.Index) Slice(Ast.Node.Index) { |
| 381 | 381 | ||
| 382 | fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { | 382 | fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { |
| 383 | const g = struct { | 383 | const g = struct { |
| 384 | var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{}; | 384 | var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty; |
| 385 | }; | 385 | }; |
| 386 | g.result.clearRetainingCapacity(); | 386 | g.result.clearRetainingCapacity(); |
| 387 | const decl = decl_index.get(); | 387 | const decl = decl_index.get(); |
| ... | @@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { | ... | @@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { |
| 403 | 403 | ||
| 404 | fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { | 404 | fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index { |
| 405 | const g = struct { | 405 | const g = struct { |
| 406 | var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{}; | 406 | var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty; |
| 407 | }; | 407 | }; |
| 408 | g.result.clearRetainingCapacity(); | 408 | g.result.clearRetainingCapacity(); |
| 409 | const decl = decl_index.get(); | 409 | const decl = decl_index.get(); |
| ... | @@ -672,7 +672,7 @@ fn render_docs( | ... | @@ -672,7 +672,7 @@ fn render_docs( |
| 672 | defer parsed_doc.deinit(gpa); | 672 | defer parsed_doc.deinit(gpa); |
| 673 | 673 | ||
| 674 | const g = struct { | 674 | const g = struct { |
| 675 | var link_buffer: std.ArrayListUnmanaged(u8) = .{}; | 675 | var link_buffer: std.ArrayListUnmanaged(u8) = .empty; |
| 676 | }; | 676 | }; |
| 677 | 677 | ||
| 678 | const Writer = std.ArrayListUnmanaged(u8).Writer; | 678 | const Writer = std.ArrayListUnmanaged(u8).Writer; |
| ... | @@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index { | ... | @@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index { |
| 817 | } | 817 | } |
| 818 | 818 | ||
| 819 | /// Set by `set_input_string`. | 819 | /// Set by `set_input_string`. |
| 820 | var input_string: std.ArrayListUnmanaged(u8) = .{}; | 820 | var input_string: std.ArrayListUnmanaged(u8) = .empty; |
| 821 | 821 | ||
| 822 | export fn set_input_string(len: usize) [*]u8 { | 822 | export fn set_input_string(len: usize) [*]u8 { |
| 823 | input_string.resize(gpa, len) catch @panic("OOM"); | 823 | input_string.resize(gpa, len) catch @panic("OOM"); |
| ... | @@ -839,7 +839,7 @@ export fn find_decl() Decl.Index { | ... | @@ -839,7 +839,7 @@ export fn find_decl() Decl.Index { |
| 839 | if (result != .none) return result; | 839 | if (result != .none) return result; |
| 840 | 840 | ||
| 841 | const g = struct { | 841 | const g = struct { |
| 842 | var match_fqn: std.ArrayListUnmanaged(u8) = .{}; | 842 | var match_fqn: std.ArrayListUnmanaged(u8) = .empty; |
| 843 | }; | 843 | }; |
| 844 | for (Walk.decls.items, 0..) |*decl, decl_index| { | 844 | for (Walk.decls.items, 0..) |*decl, decl_index| { |
| 845 | g.match_fqn.clearRetainingCapacity(); | 845 | g.match_fqn.clearRetainingCapacity(); |
| ... | @@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl. | ... | @@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl. |
| 888 | 888 | ||
| 889 | export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) { | 889 | export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) { |
| 890 | const g = struct { | 890 | const g = struct { |
| 891 | var members: std.ArrayListUnmanaged(Decl.Index) = .{}; | 891 | var members: std.ArrayListUnmanaged(Decl.Index) = .empty; |
| 892 | }; | 892 | }; |
| 893 | 893 | ||
| 894 | g.members.clearRetainingCapacity(); | 894 | g.members.clearRetainingCapacity(); |
lib/docs/wasm/markdown/Parser.zig+7-7| ... | @@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData; | ... | @@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData; |
| 31 | const StringIndex = Document.StringIndex; | 31 | const StringIndex = Document.StringIndex; |
| 32 | 32 | ||
| 33 | nodes: Node.List = .{}, | 33 | nodes: Node.List = .{}, |
| 34 | extra: std.ArrayListUnmanaged(u32) = .{}, | 34 | extra: std.ArrayListUnmanaged(u32) = .empty, |
| 35 | scratch_extra: std.ArrayListUnmanaged(u32) = .{}, | 35 | scratch_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 36 | string_bytes: std.ArrayListUnmanaged(u8) = .{}, | 36 | string_bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 37 | scratch_string: std.ArrayListUnmanaged(u8) = .{}, | 37 | scratch_string: std.ArrayListUnmanaged(u8) = .empty, |
| 38 | pending_blocks: std.ArrayListUnmanaged(Block) = .{}, | 38 | pending_blocks: std.ArrayListUnmanaged(Block) = .empty, |
| 39 | allocator: Allocator, | 39 | allocator: Allocator, |
| 40 | 40 | ||
| 41 | const Parser = @This(); | 41 | const Parser = @This(); |
| ... | @@ -928,8 +928,8 @@ const InlineParser = struct { | ... | @@ -928,8 +928,8 @@ const InlineParser = struct { |
| 928 | parent: *Parser, | 928 | parent: *Parser, |
| 929 | content: []const u8, | 929 | content: []const u8, |
| 930 | pos: usize = 0, | 930 | pos: usize = 0, |
| 931 | pending_inlines: std.ArrayListUnmanaged(PendingInline) = .{}, | 931 | pending_inlines: std.ArrayListUnmanaged(PendingInline) = .empty, |
| 932 | completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .{}, | 932 | completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .empty, |
| 933 | 933 | ||
| 934 | const PendingInline = struct { | 934 | const PendingInline = struct { |
| 935 | tag: Tag, | 935 | tag: Tag, |
lib/fuzzer.zig+1-1| ... | @@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn { | ... | @@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn { |
| 402 | } | 402 | } |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 405 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 406 | 406 | ||
| 407 | var fuzzer: Fuzzer = .{ | 407 | var fuzzer: Fuzzer = .{ |
| 408 | .gpa = general_purpose_allocator.allocator(), | 408 | .gpa = general_purpose_allocator.allocator(), |
lib/fuzzer/web/main.zig+10-10| ... | @@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 { | ... | @@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 { |
| 58 | return slice.ptr; | 58 | return slice.ptr; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{}; | 61 | var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty; |
| 62 | 62 | ||
| 63 | /// Resizes the message buffer to be the correct length; returns the pointer to | 63 | /// Resizes the message buffer to be the correct length; returns the pointer to |
| 64 | /// the query string. | 64 | /// the query string. |
| ... | @@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void { | ... | @@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void { |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /// Set by `set_input_string`. | 92 | /// Set by `set_input_string`. |
| 93 | var input_string: std.ArrayListUnmanaged(u8) = .{}; | 93 | var input_string: std.ArrayListUnmanaged(u8) = .empty; |
| 94 | var string_result: std.ArrayListUnmanaged(u8) = .{}; | 94 | var string_result: std.ArrayListUnmanaged(u8) = .empty; |
| 95 | 95 | ||
| 96 | export fn set_input_string(len: usize) [*]u8 { | 96 | export fn set_input_string(len: usize) [*]u8 { |
| 97 | input_string.resize(gpa, len) catch @panic("OOM"); | 97 | input_string.resize(gpa, len) catch @panic("OOM"); |
| ... | @@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void { | ... | @@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 249 | js.emitCoverageUpdate(); | 249 | js.emitCoverageUpdate(); |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | var entry_points: std.ArrayListUnmanaged(u32) = .{}; | 252 | var entry_points: std.ArrayListUnmanaged(u32) = .empty; |
| 253 | 253 | ||
| 254 | fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void { | 254 | fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void { |
| 255 | const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*); | 255 | const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*); |
| ... | @@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) { | ... | @@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) { |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index { | 297 | fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index { |
| 298 | var buf: std.ArrayListUnmanaged(u8) = .{}; | 298 | var buf: std.ArrayListUnmanaged(u8) = .empty; |
| 299 | defer buf.deinit(gpa); | 299 | defer buf.deinit(gpa); |
| 300 | sli.appendPath(&buf) catch @panic("OOM"); | 300 | sli.appendPath(&buf) catch @panic("OOM"); |
| 301 | return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null); | 301 | return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null); |
| ... | @@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) { | ... | @@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) { |
| 307 | ) error{ OutOfMemory, SourceUnavailable }!void { | 307 | ) error{ OutOfMemory, SourceUnavailable }!void { |
| 308 | const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable; | 308 | const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable; |
| 309 | const root_node = walk_file_index.findRootDecl().get().ast_node; | 309 | 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; |
| 311 | defer annotations.deinit(gpa); | 311 | defer annotations.deinit(gpa); |
| 312 | try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items); | 312 | try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items); |
| 313 | html_render.fileSourceHtml(walk_file_index, out, root_node, .{ | 313 | html_render.fileSourceHtml(walk_file_index, out, root_node, .{ |
| ... | @@ -327,7 +327,7 @@ fn computeSourceAnnotations( | ... | @@ -327,7 +327,7 @@ fn computeSourceAnnotations( |
| 327 | // Collect all the source locations from only this file into this array | 327 | // Collect all the source locations from only this file into this array |
| 328 | // first, then sort by line, col, so that we can collect annotations with | 328 | // first, then sort by line, col, so that we can collect annotations with |
| 329 | // O(N) time complexity. | 329 | // O(N) time complexity. |
| 330 | var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .{}; | 330 | var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .empty; |
| 331 | defer locs.deinit(gpa); | 331 | defer locs.deinit(gpa); |
| 332 | 332 | ||
| 333 | for (source_locations, 0..) |sl, sli_usize| { | 333 | for (source_locations, 0..) |sl, sli_usize| { |
| ... | @@ -374,9 +374,9 @@ fn computeSourceAnnotations( | ... | @@ -374,9 +374,9 @@ fn computeSourceAnnotations( |
| 374 | 374 | ||
| 375 | var coverage = Coverage.init; | 375 | var coverage = Coverage.init; |
| 376 | /// Index of type `SourceLocationIndex`. | 376 | /// Index of type `SourceLocationIndex`. |
| 377 | var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .{}; | 377 | var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .empty; |
| 378 | /// Contains the most recent coverage update message, unmodified. | 378 | /// Contains the most recent coverage update message, unmodified. |
| 379 | var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{}; | 379 | var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty; |
| 380 | 380 | ||
| 381 | fn updateCoverage( | 381 | fn updateCoverage( |
| 382 | directories: []const Coverage.String, | 382 | directories: []const Coverage.String, |
| ... | @@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String { | ... | @@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String { |
| 425 | 425 | ||
| 426 | export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) { | 426 | export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) { |
| 427 | const global = struct { | 427 | const global = struct { |
| 428 | var result: std.ArrayListUnmanaged(SourceLocationIndex) = .{}; | 428 | var result: std.ArrayListUnmanaged(SourceLocationIndex) = .empty; |
| 429 | fn add(i: u32, want_file: Coverage.File.Index) void { | 429 | fn add(i: u32, want_file: Coverage.File.Index) void { |
| 430 | const src_loc_index: SourceLocationIndex = @enumFromInt(i); | 430 | const src_loc_index: SourceLocationIndex = @enumFromInt(i); |
| 431 | if (src_loc_index.ptr().file == want_file) result.appendAssumeCapacity(src_loc_index); | 431 | 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 { | ... | @@ -111,7 +111,7 @@ pub const ReleaseMode = enum { |
| 111 | /// Settings that are here rather than in Build are not configurable per-package. | 111 | /// Settings that are here rather than in Build are not configurable per-package. |
| 112 | pub const Graph = struct { | 112 | pub const Graph = struct { |
| 113 | arena: Allocator, | 113 | arena: Allocator, |
| 114 | system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .{}, | 114 | system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty, |
| 115 | system_package_mode: bool = false, | 115 | system_package_mode: bool = false, |
| 116 | debug_compiler_runtime_libs: bool = false, | 116 | debug_compiler_runtime_libs: bool = false, |
| 117 | cache: Cache, | 117 | cache: Cache, |
| ... | @@ -119,7 +119,7 @@ pub const Graph = struct { | ... | @@ -119,7 +119,7 @@ pub const Graph = struct { |
| 119 | env_map: EnvMap, | 119 | env_map: EnvMap, |
| 120 | global_cache_root: Cache.Directory, | 120 | global_cache_root: Cache.Directory, |
| 121 | zig_lib_directory: Cache.Directory, | 121 | zig_lib_directory: Cache.Directory, |
| 122 | needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .{}, | 122 | needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 123 | /// Information about the native target. Computed before build() is invoked. | 123 | /// Information about the native target. Computed before build() is invoked. |
| 124 | host: ResolvedTarget, | 124 | host: ResolvedTarget, |
| 125 | incremental: ?bool = null, | 125 | incremental: ?bool = null, |
lib/std/Build/Fuzz.zig+1-1| ... | @@ -30,7 +30,7 @@ pub fn start( | ... | @@ -30,7 +30,7 @@ pub fn start( |
| 30 | defer rebuild_node.end(); | 30 | defer rebuild_node.end(); |
| 31 | var wait_group: std.Thread.WaitGroup = .{}; | 31 | var wait_group: std.Thread.WaitGroup = .{}; |
| 32 | defer wait_group.wait(); | 32 | defer wait_group.wait(); |
| 33 | var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .{}; | 33 | var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .empty; |
| 34 | defer fuzz_run_steps.deinit(gpa); | 34 | defer fuzz_run_steps.deinit(gpa); |
| 35 | for (all_steps) |step| { | 35 | for (all_steps) |step| { |
| 36 | const run = step.cast(Step.Run) orelse continue; | 36 | const run = step.cast(Step.Run) orelse continue; |
lib/std/Build/Fuzz/WebServer.zig+1-1| ... | @@ -236,7 +236,7 @@ fn buildWasmBinary( | ... | @@ -236,7 +236,7 @@ fn buildWasmBinary( |
| 236 | .sub_path = "docs/wasm/html_render.zig", | 236 | .sub_path = "docs/wasm/html_render.zig", |
| 237 | }; | 237 | }; |
| 238 | 238 | ||
| 239 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; | 239 | var argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 240 | 240 | ||
| 241 | try argv.appendSlice(arena, &.{ | 241 | try argv.appendSlice(arena, &.{ |
| 242 | ws.zig_exe_path, "build-exe", // | 242 | ws.zig_exe_path, "build-exe", // |
lib/std/Build/Step.zig+1-1| ... | @@ -714,7 +714,7 @@ pub fn allocPrintCmd2( | ... | @@ -714,7 +714,7 @@ pub fn allocPrintCmd2( |
| 714 | opt_env: ?*const std.process.EnvMap, | 714 | opt_env: ?*const std.process.EnvMap, |
| 715 | argv: []const []const u8, | 715 | argv: []const []const u8, |
| 716 | ) Allocator.Error![]u8 { | 716 | ) Allocator.Error![]u8 { |
| 717 | var buf: std.ArrayListUnmanaged(u8) = .{}; | 717 | var buf: std.ArrayListUnmanaged(u8) = .empty; |
| 718 | if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd}); | 718 | if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd}); |
| 719 | if (opt_env) |env| { | 719 | if (opt_env) |env| { |
| 720 | const process_env_map = std.process.getEnvMap(arena) catch std.process.EnvMap.init(arena); | 720 | 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 { | ... | @@ -713,12 +713,12 @@ const MachODumper = struct { |
| 713 | gpa: Allocator, | 713 | gpa: Allocator, |
| 714 | data: []const u8, | 714 | data: []const u8, |
| 715 | header: macho.mach_header_64, | 715 | header: macho.mach_header_64, |
| 716 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, | 716 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, |
| 717 | sections: std.ArrayListUnmanaged(macho.section_64) = .{}, | 717 | sections: std.ArrayListUnmanaged(macho.section_64) = .empty, |
| 718 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, | 718 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, |
| 719 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 719 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 720 | indsymtab: std.ArrayListUnmanaged(u32) = .{}, | 720 | indsymtab: std.ArrayListUnmanaged(u32) = .empty, |
| 721 | imports: std.ArrayListUnmanaged([]const u8) = .{}, | 721 | imports: std.ArrayListUnmanaged([]const u8) = .empty, |
| 722 | 722 | ||
| 723 | fn parse(ctx: *ObjectContext) !void { | 723 | fn parse(ctx: *ObjectContext) !void { |
| 724 | var it = ctx.getLoadCommandIterator(); | 724 | var it = ctx.getLoadCommandIterator(); |
| ... | @@ -1797,9 +1797,9 @@ const ElfDumper = struct { | ... | @@ -1797,9 +1797,9 @@ const ElfDumper = struct { |
| 1797 | const ArchiveContext = struct { | 1797 | const ArchiveContext = struct { |
| 1798 | gpa: Allocator, | 1798 | gpa: Allocator, |
| 1799 | data: []const u8, | 1799 | data: []const u8, |
| 1800 | symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .{}, | 1800 | symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .empty, |
| 1801 | strtab: []const u8, | 1801 | 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, |
| 1803 | 1803 | ||
| 1804 | fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void { | 1804 | fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void { |
| 1805 | var stream = std.io.fixedBufferStream(raw); | 1805 | 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 { | ... | @@ -1070,8 +1070,8 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1070 | // Stores system libraries that have already been seen for at least one | 1070 | // Stores system libraries that have already been seen for at least one |
| 1071 | // module, along with any arguments that need to be passed to the | 1071 | // module, along with any arguments that need to be passed to the |
| 1072 | // compiler for each module individually. | 1072 | // compiler for each module individually. |
| 1073 | var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .{}; | 1073 | var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .empty; |
| 1074 | var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .{}; | 1074 | var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .empty; |
| 1075 | 1075 | ||
| 1076 | var prev_has_cflags = false; | 1076 | var prev_has_cflags = false; |
| 1077 | var prev_has_rcflags = false; | 1077 | 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 { | ... | @@ -48,7 +48,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 48 | const arena = b.allocator; | 48 | const arena = b.allocator; |
| 49 | const fmt: *Fmt = @fieldParentPtr("step", step); | 49 | const fmt: *Fmt = @fieldParentPtr("step", step); |
| 50 | 50 | ||
| 51 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; | 51 | var argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 52 | try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len); | 52 | try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len); |
| 53 | 53 | ||
| 54 | argv.appendAssumeCapacity(b.graph.zig_exe); | 54 | argv.appendAssumeCapacity(b.graph.zig_exe); |
lib/std/Build/Step/Run.zig+1-1| ... | @@ -856,7 +856,7 @@ pub fn rerunInFuzzMode( | ... | @@ -856,7 +856,7 @@ pub fn rerunInFuzzMode( |
| 856 | const step = &run.step; | 856 | const step = &run.step; |
| 857 | const b = step.owner; | 857 | const b = step.owner; |
| 858 | const arena = b.allocator; | 858 | const arena = b.allocator; |
| 859 | var argv_list: std.ArrayListUnmanaged([]const u8) = .{}; | 859 | var argv_list: std.ArrayListUnmanaged([]const u8) = .empty; |
| 860 | for (run.argv.items) |arg| { | 860 | for (run.argv.items) |arg| { |
| 861 | switch (arg) { | 861 | switch (arg) { |
| 862 | .bytes => |bytes| { | 862 | .bytes => |bytes| { |
lib/std/array_hash_map.zig+3-3| ... | @@ -130,7 +130,7 @@ pub fn ArrayHashMap( | ... | @@ -130,7 +130,7 @@ pub fn ArrayHashMap( |
| 130 | } | 130 | } |
| 131 | pub fn initContext(allocator: Allocator, ctx: Context) Self { | 131 | pub fn initContext(allocator: Allocator, ctx: Context) Self { |
| 132 | return .{ | 132 | return .{ |
| 133 | .unmanaged = .{}, | 133 | .unmanaged = .empty, |
| 134 | .allocator = allocator, | 134 | .allocator = allocator, |
| 135 | .ctx = ctx, | 135 | .ctx = ctx, |
| 136 | }; | 136 | }; |
| ... | @@ -429,7 +429,7 @@ pub fn ArrayHashMap( | ... | @@ -429,7 +429,7 @@ pub fn ArrayHashMap( |
| 429 | pub fn move(self: *Self) Self { | 429 | pub fn move(self: *Self) Self { |
| 430 | self.unmanaged.pointer_stability.assertUnlocked(); | 430 | self.unmanaged.pointer_stability.assertUnlocked(); |
| 431 | const result = self.*; | 431 | const result = self.*; |
| 432 | self.unmanaged = .{}; | 432 | self.unmanaged = .empty; |
| 433 | return result; | 433 | return result; |
| 434 | } | 434 | } |
| 435 | 435 | ||
| ... | @@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged( | ... | @@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged( |
| 1290 | pub fn move(self: *Self) Self { | 1290 | pub fn move(self: *Self) Self { |
| 1291 | self.pointer_stability.assertUnlocked(); | 1291 | self.pointer_stability.assertUnlocked(); |
| 1292 | const result = self.*; | 1292 | const result = self.*; |
| 1293 | self.* = .{}; | 1293 | self.* = .empty; |
| 1294 | return result; | 1294 | return result; |
| 1295 | } | 1295 | } |
| 1296 | 1296 |
lib/std/array_list.zig+32-32| ... | @@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 710 | const old_memory = self.allocatedSlice(); | 710 | const old_memory = self.allocatedSlice(); |
| 711 | if (allocator.resize(old_memory, self.items.len)) { | 711 | if (allocator.resize(old_memory, self.items.len)) { |
| 712 | const result = self.items; | 712 | const result = self.items; |
| 713 | self.* = .{}; | 713 | self.* = .empty; |
| 714 | return result; | 714 | return result; |
| 715 | } | 715 | } |
| 716 | 716 | ||
| ... | @@ -1267,7 +1267,7 @@ test "init" { | ... | @@ -1267,7 +1267,7 @@ test "init" { |
| 1267 | } | 1267 | } |
| 1268 | 1268 | ||
| 1269 | { | 1269 | { |
| 1270 | const list = ArrayListUnmanaged(i32){}; | 1270 | const list: ArrayListUnmanaged(i32) = .empty; |
| 1271 | 1271 | ||
| 1272 | try testing.expect(list.items.len == 0); | 1272 | try testing.expect(list.items.len == 0); |
| 1273 | try testing.expect(list.capacity == 0); | 1273 | try testing.expect(list.capacity == 0); |
| ... | @@ -1312,7 +1312,7 @@ test "clone" { | ... | @@ -1312,7 +1312,7 @@ test "clone" { |
| 1312 | try testing.expectEqual(@as(i32, 5), cloned.items[2]); | 1312 | try testing.expectEqual(@as(i32, 5), cloned.items[2]); |
| 1313 | } | 1313 | } |
| 1314 | { | 1314 | { |
| 1315 | var array = ArrayListUnmanaged(i32){}; | 1315 | var array: ArrayListUnmanaged(i32) = .empty; |
| 1316 | try array.append(a, -1); | 1316 | try array.append(a, -1); |
| 1317 | try array.append(a, 3); | 1317 | try array.append(a, 3); |
| 1318 | try array.append(a, 5); | 1318 | try array.append(a, 5); |
| ... | @@ -1384,7 +1384,7 @@ test "basic" { | ... | @@ -1384,7 +1384,7 @@ test "basic" { |
| 1384 | try testing.expect(list.pop() == 33); | 1384 | try testing.expect(list.pop() == 33); |
| 1385 | } | 1385 | } |
| 1386 | { | 1386 | { |
| 1387 | var list = ArrayListUnmanaged(i32){}; | 1387 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1388 | defer list.deinit(a); | 1388 | defer list.deinit(a); |
| 1389 | 1389 | ||
| 1390 | { | 1390 | { |
| ... | @@ -1448,7 +1448,7 @@ test "appendNTimes" { | ... | @@ -1448,7 +1448,7 @@ test "appendNTimes" { |
| 1448 | } | 1448 | } |
| 1449 | } | 1449 | } |
| 1450 | { | 1450 | { |
| 1451 | var list = ArrayListUnmanaged(i32){}; | 1451 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1452 | defer list.deinit(a); | 1452 | defer list.deinit(a); |
| 1453 | 1453 | ||
| 1454 | try list.appendNTimes(a, 2, 10); | 1454 | try list.appendNTimes(a, 2, 10); |
| ... | @@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" { | ... | @@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" { |
| 1467 | try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10)); | 1467 | try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10)); |
| 1468 | } | 1468 | } |
| 1469 | { | 1469 | { |
| 1470 | var list = ArrayListUnmanaged(i32){}; | 1470 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1471 | defer list.deinit(a); | 1471 | defer list.deinit(a); |
| 1472 | try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10)); | 1472 | try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10)); |
| 1473 | } | 1473 | } |
| ... | @@ -1502,7 +1502,7 @@ test "orderedRemove" { | ... | @@ -1502,7 +1502,7 @@ test "orderedRemove" { |
| 1502 | try testing.expectEqual(@as(usize, 4), list.items.len); | 1502 | try testing.expectEqual(@as(usize, 4), list.items.len); |
| 1503 | } | 1503 | } |
| 1504 | { | 1504 | { |
| 1505 | var list = ArrayListUnmanaged(i32){}; | 1505 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1506 | defer list.deinit(a); | 1506 | defer list.deinit(a); |
| 1507 | 1507 | ||
| 1508 | try list.append(a, 1); | 1508 | try list.append(a, 1); |
| ... | @@ -1537,7 +1537,7 @@ test "orderedRemove" { | ... | @@ -1537,7 +1537,7 @@ test "orderedRemove" { |
| 1537 | } | 1537 | } |
| 1538 | { | 1538 | { |
| 1539 | // remove last item | 1539 | // remove last item |
| 1540 | var list = ArrayListUnmanaged(i32){}; | 1540 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1541 | defer list.deinit(a); | 1541 | defer list.deinit(a); |
| 1542 | try list.append(a, 1); | 1542 | try list.append(a, 1); |
| 1543 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); | 1543 | try testing.expectEqual(@as(i32, 1), list.orderedRemove(0)); |
| ... | @@ -1574,7 +1574,7 @@ test "swapRemove" { | ... | @@ -1574,7 +1574,7 @@ test "swapRemove" { |
| 1574 | try testing.expect(list.items.len == 4); | 1574 | try testing.expect(list.items.len == 4); |
| 1575 | } | 1575 | } |
| 1576 | { | 1576 | { |
| 1577 | var list = ArrayListUnmanaged(i32){}; | 1577 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1578 | defer list.deinit(a); | 1578 | defer list.deinit(a); |
| 1579 | 1579 | ||
| 1580 | try list.append(a, 1); | 1580 | try list.append(a, 1); |
| ... | @@ -1617,7 +1617,7 @@ test "insert" { | ... | @@ -1617,7 +1617,7 @@ test "insert" { |
| 1617 | try testing.expect(list.items[3] == 3); | 1617 | try testing.expect(list.items[3] == 3); |
| 1618 | } | 1618 | } |
| 1619 | { | 1619 | { |
| 1620 | var list = ArrayListUnmanaged(i32){}; | 1620 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1621 | defer list.deinit(a); | 1621 | defer list.deinit(a); |
| 1622 | 1622 | ||
| 1623 | try list.insert(a, 0, 1); | 1623 | try list.insert(a, 0, 1); |
| ... | @@ -1655,7 +1655,7 @@ test "insertSlice" { | ... | @@ -1655,7 +1655,7 @@ test "insertSlice" { |
| 1655 | try testing.expect(list.items[0] == 1); | 1655 | try testing.expect(list.items[0] == 1); |
| 1656 | } | 1656 | } |
| 1657 | { | 1657 | { |
| 1658 | var list = ArrayListUnmanaged(i32){}; | 1658 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1659 | defer list.deinit(a); | 1659 | defer list.deinit(a); |
| 1660 | 1660 | ||
| 1661 | try list.append(a, 1); | 1661 | try list.append(a, 1); |
| ... | @@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1789 | const a = testing.allocator; | 1789 | const a = testing.allocator; |
| 1790 | 1790 | ||
| 1791 | { | 1791 | { |
| 1792 | var list = ArrayListUnmanaged(i32){}; | 1792 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1793 | defer list.deinit(a); | 1793 | defer list.deinit(a); |
| 1794 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1794 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1795 | 1795 | ||
| ... | @@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1798 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 1798 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 1799 | } | 1799 | } |
| 1800 | { | 1800 | { |
| 1801 | var list = ArrayListUnmanaged(i32){}; | 1801 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1802 | defer list.deinit(a); | 1802 | defer list.deinit(a); |
| 1803 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1803 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1804 | 1804 | ||
| ... | @@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1811 | ); | 1811 | ); |
| 1812 | } | 1812 | } |
| 1813 | { | 1813 | { |
| 1814 | var list = ArrayListUnmanaged(i32){}; | 1814 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1815 | defer list.deinit(a); | 1815 | defer list.deinit(a); |
| 1816 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1816 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1817 | 1817 | ||
| ... | @@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1820 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 1820 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 1821 | } | 1821 | } |
| 1822 | { | 1822 | { |
| 1823 | var list = ArrayListUnmanaged(i32){}; | 1823 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1824 | defer list.deinit(a); | 1824 | defer list.deinit(a); |
| 1825 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1825 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1826 | 1826 | ||
| ... | @@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" { | ... | @@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" { |
| 1829 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 1829 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 1830 | } | 1830 | } |
| 1831 | { | 1831 | { |
| 1832 | var list = ArrayListUnmanaged(i32){}; | 1832 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1833 | defer list.deinit(a); | 1833 | defer list.deinit(a); |
| 1834 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1834 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1835 | 1835 | ||
| ... | @@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 1843 | const a = testing.allocator; | 1843 | const a = testing.allocator; |
| 1844 | 1844 | ||
| 1845 | { | 1845 | { |
| 1846 | var list = ArrayListUnmanaged(i32){}; | 1846 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1847 | defer list.deinit(a); | 1847 | defer list.deinit(a); |
| 1848 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1848 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1849 | 1849 | ||
| ... | @@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 1852 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); | 1852 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items); |
| 1853 | } | 1853 | } |
| 1854 | { | 1854 | { |
| 1855 | var list = ArrayListUnmanaged(i32){}; | 1855 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1856 | defer list.deinit(a); | 1856 | defer list.deinit(a); |
| 1857 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1857 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1858 | 1858 | ||
| ... | @@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 1865 | ); | 1865 | ); |
| 1866 | } | 1866 | } |
| 1867 | { | 1867 | { |
| 1868 | var list = ArrayListUnmanaged(i32){}; | 1868 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1869 | defer list.deinit(a); | 1869 | defer list.deinit(a); |
| 1870 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1870 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1871 | 1871 | ||
| ... | @@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 1874 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); | 1874 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items); |
| 1875 | } | 1875 | } |
| 1876 | { | 1876 | { |
| 1877 | var list = ArrayListUnmanaged(i32){}; | 1877 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1878 | defer list.deinit(a); | 1878 | defer list.deinit(a); |
| 1879 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1879 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1880 | 1880 | ||
| ... | @@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { | ... | @@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" { |
| 1883 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); | 1883 | try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items); |
| 1884 | } | 1884 | } |
| 1885 | { | 1885 | { |
| 1886 | var list = ArrayListUnmanaged(i32){}; | 1886 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1887 | defer list.deinit(a); | 1887 | defer list.deinit(a); |
| 1888 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); | 1888 | try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 }); |
| 1889 | 1889 | ||
| ... | @@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct { | ... | @@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct { |
| 1906 | test "ArrayList(T) of struct T" { | 1906 | test "ArrayList(T) of struct T" { |
| 1907 | const a = std.testing.allocator; | 1907 | const a = std.testing.allocator; |
| 1908 | { | 1908 | { |
| 1909 | var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(a) }; | 1909 | var root = Item{ .integer = 1, .sub_items = .init(a) }; |
| 1910 | defer root.sub_items.deinit(); | 1910 | 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) }); |
| 1912 | try testing.expect(root.sub_items.items[0].integer == 42); | 1912 | try testing.expect(root.sub_items.items[0].integer == 42); |
| 1913 | } | 1913 | } |
| 1914 | { | 1914 | { |
| 1915 | var root = ItemUnmanaged{ .integer = 1, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} }; | 1915 | var root = ItemUnmanaged{ .integer = 1, .sub_items = .empty }; |
| 1916 | defer root.sub_items.deinit(a); | 1916 | 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 }); |
| 1918 | try testing.expect(root.sub_items.items[0].integer == 42); | 1918 | try testing.expect(root.sub_items.items[0].integer == 42); |
| 1919 | } | 1919 | } |
| 1920 | } | 1920 | } |
| ... | @@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" { | ... | @@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" { |
| 1950 | const a = testing.allocator; | 1950 | const a = testing.allocator; |
| 1951 | 1951 | ||
| 1952 | { | 1952 | { |
| 1953 | var buffer: ArrayListUnmanaged(u8) = .{}; | 1953 | var buffer: ArrayListUnmanaged(u8) = .empty; |
| 1954 | defer buffer.deinit(a); | 1954 | defer buffer.deinit(a); |
| 1955 | 1955 | ||
| 1956 | const x: i32 = 42; | 1956 | const x: i32 = 42; |
| ... | @@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" { | ... | @@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" { |
| 1960 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); | 1960 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); |
| 1961 | } | 1961 | } |
| 1962 | { | 1962 | { |
| 1963 | var list: ArrayListAlignedUnmanaged(u8, 2) = .{}; | 1963 | var list: ArrayListAlignedUnmanaged(u8, 2) = .empty; |
| 1964 | defer list.deinit(a); | 1964 | defer list.deinit(a); |
| 1965 | 1965 | ||
| 1966 | const writer = list.writer(a); | 1966 | const writer = list.writer(a); |
| ... | @@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" { | ... | @@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" { |
| 1989 | try testing.expect(list.items.len == 1); | 1989 | try testing.expect(list.items.len == 1); |
| 1990 | } | 1990 | } |
| 1991 | { | 1991 | { |
| 1992 | var list = ArrayListUnmanaged(i32){}; | 1992 | var list: ArrayListUnmanaged(i32) = .empty; |
| 1993 | defer list.deinit(a); | 1993 | defer list.deinit(a); |
| 1994 | 1994 | ||
| 1995 | try list.append(a, 1); | 1995 | try list.append(a, 1); |
| ... | @@ -2026,7 +2026,7 @@ test "addManyAsArray" { | ... | @@ -2026,7 +2026,7 @@ test "addManyAsArray" { |
| 2026 | try testing.expectEqualSlices(u8, list.items, "aoeuasdf"); | 2026 | try testing.expectEqualSlices(u8, list.items, "aoeuasdf"); |
| 2027 | } | 2027 | } |
| 2028 | { | 2028 | { |
| 2029 | var list = ArrayListUnmanaged(u8){}; | 2029 | var list: ArrayListUnmanaged(u8) = .empty; |
| 2030 | defer list.deinit(a); | 2030 | defer list.deinit(a); |
| 2031 | 2031 | ||
| 2032 | (try list.addManyAsArray(a, 4)).* = "aoeu".*; | 2032 | (try list.addManyAsArray(a, 4)).* = "aoeu".*; |
| ... | @@ -2056,7 +2056,7 @@ test "growing memory preserves contents" { | ... | @@ -2056,7 +2056,7 @@ test "growing memory preserves contents" { |
| 2056 | try testing.expectEqualSlices(u8, list.items, "abcdijklefgh"); | 2056 | try testing.expectEqualSlices(u8, list.items, "abcdijklefgh"); |
| 2057 | } | 2057 | } |
| 2058 | { | 2058 | { |
| 2059 | var list = ArrayListUnmanaged(u8){}; | 2059 | var list: ArrayListUnmanaged(u8) = .empty; |
| 2060 | defer list.deinit(a); | 2060 | defer list.deinit(a); |
| 2061 | 2061 | ||
| 2062 | (try list.addManyAsArray(a, 4)).* = "abcd".*; | 2062 | (try list.addManyAsArray(a, 4)).* = "abcd".*; |
| ... | @@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" { | ... | @@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" { |
| 2132 | try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0)); | 2132 | try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0)); |
| 2133 | } | 2133 | } |
| 2134 | { | 2134 | { |
| 2135 | var list = ArrayListUnmanaged(u8){}; | 2135 | var list: ArrayListUnmanaged(u8) = .empty; |
| 2136 | defer list.deinit(a); | 2136 | defer list.deinit(a); |
| 2137 | 2137 | ||
| 2138 | try list.appendSlice(a, "foobar"); | 2138 | try list.appendSlice(a, "foobar"); |
| ... | @@ -2156,7 +2156,7 @@ test "accepts unaligned slices" { | ... | @@ -2156,7 +2156,7 @@ test "accepts unaligned slices" { |
| 2156 | try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 }); | 2156 | try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 }); |
| 2157 | } | 2157 | } |
| 2158 | { | 2158 | { |
| 2159 | var list = std.ArrayListAlignedUnmanaged(u8, 8){}; | 2159 | var list: std.ArrayListAlignedUnmanaged(u8, 8) = .empty; |
| 2160 | defer list.deinit(a); | 2160 | defer list.deinit(a); |
| 2161 | 2161 | ||
| 2162 | try list.appendSlice(a, &.{ 0, 1, 2, 3 }); | 2162 | try list.appendSlice(a, &.{ 0, 1, 2, 3 }); |
lib/std/crypto/Certificate/Bundle.zig+2-2| ... | @@ -6,8 +6,8 @@ | ... | @@ -6,8 +6,8 @@ |
| 6 | //! certificate within `bytes`. | 6 | //! certificate within `bytes`. |
| 7 | 7 | ||
| 8 | /// The key is the contents slice of the subject. | 8 | /// The key is the contents slice of the subject. |
| 9 | map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .{}, | 9 | map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .empty, |
| 10 | bytes: std.ArrayListUnmanaged(u8) = .{}, | 10 | bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 11 | 11 | ||
| 12 | pub const VerifyError = Certificate.Parsed.VerifyError || error{ | 12 | pub const VerifyError = Certificate.Parsed.VerifyError || error{ |
| 13 | CertificateIssuerNotFound, | 13 | CertificateIssuerNotFound, |
lib/std/debug/Dwarf.zig+8-8| ... | @@ -42,20 +42,20 @@ sections: SectionArray = null_section_array, | ... | @@ -42,20 +42,20 @@ sections: SectionArray = null_section_array, |
| 42 | is_macho: bool, | 42 | is_macho: bool, |
| 43 | 43 | ||
| 44 | /// Filled later by the initializer | 44 | /// Filled later by the initializer |
| 45 | abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .{}, | 45 | abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty, |
| 46 | /// Filled later by the initializer | 46 | /// Filled later by the initializer |
| 47 | compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .{}, | 47 | compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty, |
| 48 | /// Filled later by the initializer | 48 | /// Filled later by the initializer |
| 49 | func_list: std.ArrayListUnmanaged(Func) = .{}, | 49 | func_list: std.ArrayListUnmanaged(Func) = .empty, |
| 50 | 50 | ||
| 51 | eh_frame_hdr: ?ExceptionFrameHeader = null, | 51 | eh_frame_hdr: ?ExceptionFrameHeader = null, |
| 52 | /// These lookup tables are only used if `eh_frame_hdr` is null | 52 | /// These lookup tables are only used if `eh_frame_hdr` is null |
| 53 | cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .{}, | 53 | cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty, |
| 54 | /// Sorted by start_pc | 54 | /// Sorted by start_pc |
| 55 | fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .{}, | 55 | fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty, |
| 56 | 56 | ||
| 57 | /// Populated by `populateRanges`. | 57 | /// Populated by `populateRanges`. |
| 58 | ranges: std.ArrayListUnmanaged(Range) = .{}, | 58 | ranges: std.ArrayListUnmanaged(Range) = .empty, |
| 59 | 59 | ||
| 60 | pub const Range = struct { | 60 | pub const Range = struct { |
| 61 | start: u64, | 61 | start: u64, |
| ... | @@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) ! | ... | @@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) ! |
| 1464 | 1464 | ||
| 1465 | const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1); | 1465 | const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1); |
| 1466 | 1466 | ||
| 1467 | var directories: std.ArrayListUnmanaged(FileEntry) = .{}; | 1467 | var directories: std.ArrayListUnmanaged(FileEntry) = .empty; |
| 1468 | defer directories.deinit(gpa); | 1468 | defer directories.deinit(gpa); |
| 1469 | var file_entries: std.ArrayListUnmanaged(FileEntry) = .{}; | 1469 | var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty; |
| 1470 | defer file_entries.deinit(gpa); | 1470 | defer file_entries.deinit(gpa); |
| 1471 | 1471 | ||
| 1472 | if (version < 5) { | 1472 | if (version < 5) { |
lib/std/debug/Dwarf/expression.zig+1-1| ... | @@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type { | ... | @@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type { |
| 153 | } | 153 | } |
| 154 | }; | 154 | }; |
| 155 | 155 | ||
| 156 | stack: std.ArrayListUnmanaged(Value) = .{}, | 156 | stack: std.ArrayListUnmanaged(Value) = .empty, |
| 157 | 157 | ||
| 158 | pub fn reset(self: *Self) void { | 158 | pub fn reset(self: *Self) void { |
| 159 | self.stack.clearRetainingCapacity(); | 159 | self.stack.clearRetainingCapacity(); |
lib/std/debug/SelfInfo.zig+2-2| ... | @@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct { | ... | @@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct { |
| 1933 | len: u8 = 0, | 1933 | len: u8 = 0, |
| 1934 | }; | 1934 | }; |
| 1935 | 1935 | ||
| 1936 | columns: std.ArrayListUnmanaged(Column) = .{}, | 1936 | columns: std.ArrayListUnmanaged(Column) = .empty, |
| 1937 | stack: std.ArrayListUnmanaged(ColumnRange) = .{}, | 1937 | stack: std.ArrayListUnmanaged(ColumnRange) = .empty, |
| 1938 | current_row: Row = .{}, | 1938 | current_row: Row = .{}, |
| 1939 | 1939 | ||
| 1940 | /// The result of executing the CIE's initial_instructions | 1940 | /// The result of executing the CIE's initial_instructions |
lib/std/fs/Dir.zig+1-1| ... | @@ -750,7 +750,7 @@ pub const Walker = struct { | ... | @@ -750,7 +750,7 @@ pub const Walker = struct { |
| 750 | /// | 750 | /// |
| 751 | /// `self` will not be closed after walking it. | 751 | /// `self` will not be closed after walking it. |
| 752 | pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker { | 752 | pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker { |
| 753 | var stack: std.ArrayListUnmanaged(Walker.StackItem) = .{}; | 753 | var stack: std.ArrayListUnmanaged(Walker.StackItem) = .empty; |
| 754 | 754 | ||
| 755 | try stack.append(allocator, .{ | 755 | try stack.append(allocator, .{ |
| 756 | .iter = self.iterate(), | 756 | .iter = self.iterate(), |
lib/std/fs/wasi.zig+1-1| ... | @@ -24,7 +24,7 @@ pub const Preopens = struct { | ... | @@ -24,7 +24,7 @@ pub const Preopens = struct { |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens { | 26 | pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens { |
| 27 | var names: std.ArrayListUnmanaged([]const u8) = .{}; | 27 | var names: std.ArrayListUnmanaged([]const u8) = .empty; |
| 28 | defer names.deinit(gpa); | 28 | defer names.deinit(gpa); |
| 29 | 29 | ||
| 30 | try names.ensureUnusedCapacity(gpa, 3); | 30 | try names.ensureUnusedCapacity(gpa, 3); |
lib/std/hash/benchmark.zig+1-1| ... | @@ -410,7 +410,7 @@ pub fn main() !void { | ... | @@ -410,7 +410,7 @@ pub fn main() !void { |
| 410 | } | 410 | } |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 413 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 414 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); | 414 | defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); |
| 415 | const allocator = gpa.allocator(); | 415 | const allocator = gpa.allocator(); |
| 416 | 416 |
lib/std/hash_map.zig+7-7| ... | @@ -401,7 +401,7 @@ pub fn HashMap( | ... | @@ -401,7 +401,7 @@ pub fn HashMap( |
| 401 | @compileError("Context must be specified! Call initContext(allocator, ctx) instead."); | 401 | @compileError("Context must be specified! Call initContext(allocator, ctx) instead."); |
| 402 | } | 402 | } |
| 403 | return .{ | 403 | return .{ |
| 404 | .unmanaged = .{}, | 404 | .unmanaged = .empty, |
| 405 | .allocator = allocator, | 405 | .allocator = allocator, |
| 406 | .ctx = undefined, // ctx is zero-sized so this is safe. | 406 | .ctx = undefined, // ctx is zero-sized so this is safe. |
| 407 | }; | 407 | }; |
| ... | @@ -410,7 +410,7 @@ pub fn HashMap( | ... | @@ -410,7 +410,7 @@ pub fn HashMap( |
| 410 | /// Create a managed hash map with a context | 410 | /// Create a managed hash map with a context |
| 411 | pub fn initContext(allocator: Allocator, ctx: Context) Self { | 411 | pub fn initContext(allocator: Allocator, ctx: Context) Self { |
| 412 | return .{ | 412 | return .{ |
| 413 | .unmanaged = .{}, | 413 | .unmanaged = .empty, |
| 414 | .allocator = allocator, | 414 | .allocator = allocator, |
| 415 | .ctx = ctx, | 415 | .ctx = ctx, |
| 416 | }; | 416 | }; |
| ... | @@ -691,7 +691,7 @@ pub fn HashMap( | ... | @@ -691,7 +691,7 @@ pub fn HashMap( |
| 691 | pub fn move(self: *Self) Self { | 691 | pub fn move(self: *Self) Self { |
| 692 | self.unmanaged.pointer_stability.assertUnlocked(); | 692 | self.unmanaged.pointer_stability.assertUnlocked(); |
| 693 | const result = self.*; | 693 | const result = self.*; |
| 694 | self.unmanaged = .{}; | 694 | self.unmanaged = .empty; |
| 695 | return result; | 695 | return result; |
| 696 | } | 696 | } |
| 697 | 697 | ||
| ... | @@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged( | ... | @@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged( |
| 1543 | return self.cloneContext(allocator, @as(Context, undefined)); | 1543 | return self.cloneContext(allocator, @as(Context, undefined)); |
| 1544 | } | 1544 | } |
| 1545 | pub fn cloneContext(self: Self, allocator: Allocator, new_ctx: anytype) Allocator.Error!HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) { | 1545 | 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; |
| 1547 | if (self.size == 0) | 1547 | if (self.size == 0) |
| 1548 | return other; | 1548 | return other; |
| 1549 | 1549 | ||
| ... | @@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged( | ... | @@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged( |
| 1572 | pub fn move(self: *Self) Self { | 1572 | pub fn move(self: *Self) Self { |
| 1573 | self.pointer_stability.assertUnlocked(); | 1573 | self.pointer_stability.assertUnlocked(); |
| 1574 | const result = self.*; | 1574 | const result = self.*; |
| 1575 | self.* = .{}; | 1575 | self.* = .empty; |
| 1576 | return result; | 1576 | return result; |
| 1577 | } | 1577 | } |
| 1578 | 1578 | ||
| ... | @@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" { | ... | @@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" { |
| 2360 | } | 2360 | } |
| 2361 | 2361 | ||
| 2362 | test "repeat fetchRemove" { | 2362 | test "repeat fetchRemove" { |
| 2363 | var map = AutoHashMapUnmanaged(u64, void){}; | 2363 | var map: AutoHashMapUnmanaged(u64, void) = .empty; |
| 2364 | defer map.deinit(testing.allocator); | 2364 | defer map.deinit(testing.allocator); |
| 2365 | 2365 | ||
| 2366 | try map.ensureTotalCapacity(testing.allocator, 4); | 2366 | try map.ensureTotalCapacity(testing.allocator, 4); |
| ... | @@ -2384,7 +2384,7 @@ test "repeat fetchRemove" { | ... | @@ -2384,7 +2384,7 @@ test "repeat fetchRemove" { |
| 2384 | } | 2384 | } |
| 2385 | 2385 | ||
| 2386 | test "getOrPut allocation failure" { | 2386 | test "getOrPut allocation failure" { |
| 2387 | var map: std.StringHashMapUnmanaged(void) = .{}; | 2387 | var map: std.StringHashMapUnmanaged(void) = .empty; |
| 2388 | try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello")); | 2388 | try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello")); |
| 2389 | } | 2389 | } |
| 2390 | 2390 |
lib/std/json/hashmap.zig+3-3| ... | @@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value; | ... | @@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value; |
| 12 | /// instead of comptime-known struct field names. | 12 | /// instead of comptime-known struct field names. |
| 13 | pub fn ArrayHashMap(comptime T: type) type { | 13 | pub fn ArrayHashMap(comptime T: type) type { |
| 14 | return struct { | 14 | return struct { |
| 15 | map: std.StringArrayHashMapUnmanaged(T) = .{}, | 15 | map: std.StringArrayHashMapUnmanaged(T) = .empty, |
| 16 | 16 | ||
| 17 | pub fn deinit(self: *@This(), allocator: Allocator) void { | 17 | pub fn deinit(self: *@This(), allocator: Allocator) void { |
| 18 | self.map.deinit(allocator); | 18 | self.map.deinit(allocator); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() { | 21 | pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() { |
| 22 | var map = std.StringArrayHashMapUnmanaged(T){}; | 22 | var map: std.StringArrayHashMapUnmanaged(T) = .empty; |
| 23 | errdefer map.deinit(allocator); | 23 | errdefer map.deinit(allocator); |
| 24 | 24 | ||
| 25 | if (.object_begin != try source.next()) return error.UnexpectedToken; | 25 | if (.object_begin != try source.next()) return error.UnexpectedToken; |
| ... | @@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type { | ... | @@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type { |
| 52 | pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() { | 52 | pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() { |
| 53 | if (source != .object) return error.UnexpectedToken; | 53 | if (source != .object) return error.UnexpectedToken; |
| 54 | 54 | ||
| 55 | var map = std.StringArrayHashMapUnmanaged(T){}; | 55 | var map: std.StringArrayHashMapUnmanaged(T) = .empty; |
| 56 | errdefer map.deinit(allocator); | 56 | errdefer map.deinit(allocator); |
| 57 | 57 | ||
| 58 | var it = source.object.iterator(); | 58 | var it = source.object.iterator(); |
lib/std/process/Child.zig+2-2| ... | @@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void { | ... | @@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void { |
| 907 | var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv); | 907 | var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv); |
| 908 | defer cmd_line_cache.deinit(); | 908 | defer cmd_line_cache.deinit(); |
| 909 | 909 | ||
| 910 | var app_buf = std.ArrayListUnmanaged(u16){}; | 910 | var app_buf: std.ArrayListUnmanaged(u16) = .empty; |
| 911 | defer app_buf.deinit(self.allocator); | 911 | defer app_buf.deinit(self.allocator); |
| 912 | 912 | ||
| 913 | try app_buf.appendSlice(self.allocator, app_name_w); | 913 | try app_buf.appendSlice(self.allocator, app_name_w); |
| 914 | 914 | ||
| 915 | var dir_buf = std.ArrayListUnmanaged(u16){}; | 915 | var dir_buf: std.ArrayListUnmanaged(u16) = .empty; |
| 916 | defer dir_buf.deinit(self.allocator); | 916 | defer dir_buf.deinit(self.allocator); |
| 917 | 917 | ||
| 918 | if (cwd_path_w.len > 0) { | 918 | if (cwd_path_w.len > 0) { |
lib/std/tar.zig+1-1| ... | @@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer; | ... | @@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer; |
| 27 | /// the errors in diagnostics to know whether the operation succeeded or failed. | 27 | /// the errors in diagnostics to know whether the operation succeeded or failed. |
| 28 | pub const Diagnostics = struct { | 28 | pub const Diagnostics = struct { |
| 29 | allocator: std.mem.Allocator, | 29 | allocator: std.mem.Allocator, |
| 30 | errors: std.ArrayListUnmanaged(Error) = .{}, | 30 | errors: std.ArrayListUnmanaged(Error) = .empty, |
| 31 | 31 | ||
| 32 | entries: usize = 0, | 32 | entries: usize = 0, |
| 33 | root_dir: []const u8 = "", | 33 | root_dir: []const u8 = "", |
lib/std/testing.zig+2-2| ... | @@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll | ... | @@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll |
| 11 | 11 | ||
| 12 | /// This should only be used in temporary test programs. | 12 | /// This should only be used in temporary test programs. |
| 13 | pub const allocator = allocator_instance.allocator(); | 13 | pub const allocator = allocator_instance.allocator(); |
| 14 | pub var allocator_instance = b: { | 14 | pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{}) = b: { |
| 15 | if (!builtin.is_test) | 15 | if (!builtin.is_test) |
| 16 | @compileError("Cannot use testing allocator outside of test block"); | 16 | @compileError("Cannot use testing allocator outside of test block"); |
| 17 | break :b std.heap.GeneralPurposeAllocator(.{}){}; | 17 | break :b .init; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | pub const failing_allocator = failing_allocator_instance.allocator(); | 20 | pub const failing_allocator = failing_allocator_instance.allocator(); |
lib/std/zig/AstGen.zig+20-20| ... | @@ -22,8 +22,8 @@ tree: *const Ast, | ... | @@ -22,8 +22,8 @@ tree: *const Ast, |
| 22 | /// sub-expressions. See `AstRlAnnotate` for details. | 22 | /// sub-expressions. See `AstRlAnnotate` for details. |
| 23 | nodes_need_rl: *const AstRlAnnotate.RlNeededSet, | 23 | nodes_need_rl: *const AstRlAnnotate.RlNeededSet, |
| 24 | instructions: std.MultiArrayList(Zir.Inst) = .{}, | 24 | instructions: std.MultiArrayList(Zir.Inst) = .{}, |
| 25 | extra: ArrayListUnmanaged(u32) = .{}, | 25 | extra: ArrayListUnmanaged(u32) = .empty, |
| 26 | string_bytes: ArrayListUnmanaged(u8) = .{}, | 26 | string_bytes: ArrayListUnmanaged(u8) = .empty, |
| 27 | /// Tracks the current byte offset within the source file. | 27 | /// Tracks the current byte offset within the source file. |
| 28 | /// Used to populate line deltas in the ZIR. AstGen maintains | 28 | /// Used to populate line deltas in the ZIR. AstGen maintains |
| 29 | /// this "cursor" throughout the entire AST lowering process in order | 29 | /// this "cursor" throughout the entire AST lowering process in order |
| ... | @@ -39,8 +39,8 @@ source_column: u32 = 0, | ... | @@ -39,8 +39,8 @@ source_column: u32 = 0, |
| 39 | /// Used for temporary allocations; freed after AstGen is complete. | 39 | /// Used for temporary allocations; freed after AstGen is complete. |
| 40 | /// The resulting ZIR code has no references to anything in this arena. | 40 | /// The resulting ZIR code has no references to anything in this arena. |
| 41 | arena: Allocator, | 41 | arena: Allocator, |
| 42 | string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, | 42 | string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, |
| 43 | compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .{}, | 43 | compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .empty, |
| 44 | /// The topmost block of the current function. | 44 | /// The topmost block of the current function. |
| 45 | fn_block: ?*GenZir = null, | 45 | fn_block: ?*GenZir = null, |
| 46 | fn_var_args: bool = false, | 46 | fn_var_args: bool = false, |
| ... | @@ -52,9 +52,9 @@ within_fn: bool = false, | ... | @@ -52,9 +52,9 @@ within_fn: bool = false, |
| 52 | fn_ret_ty: Zir.Inst.Ref = .none, | 52 | fn_ret_ty: Zir.Inst.Ref = .none, |
| 53 | /// Maps string table indexes to the first `@import` ZIR instruction | 53 | /// Maps string table indexes to the first `@import` ZIR instruction |
| 54 | /// that uses this string as the operand. | 54 | /// that uses this string as the operand. |
| 55 | imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{}, | 55 | imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty, |
| 56 | /// Used for temporary storage when building payloads. | 56 | /// Used for temporary storage when building payloads. |
| 57 | scratch: std.ArrayListUnmanaged(u32) = .{}, | 57 | scratch: std.ArrayListUnmanaged(u32) = .empty, |
| 58 | /// Whenever a `ref` instruction is needed, it is created and saved in this | 58 | /// Whenever a `ref` instruction is needed, it is created and saved in this |
| 59 | /// table instead of being immediately appended to the current block body. | 59 | /// table instead of being immediately appended to the current block body. |
| 60 | /// Then, when the instruction is being added to the parent block (typically from | 60 | /// Then, when the instruction is being added to the parent block (typically from |
| ... | @@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{}, | ... | @@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{}, |
| 65 | /// 2. `ref` instructions will dominate their uses. This is a required property | 65 | /// 2. `ref` instructions will dominate their uses. This is a required property |
| 66 | /// of ZIR. | 66 | /// of ZIR. |
| 67 | /// The key is the ref operand; the value is the ref instruction. | 67 | /// The key is the ref operand; the value is the ref instruction. |
| 68 | ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{}, | 68 | ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty, |
| 69 | /// Any information which should trigger invalidation of incremental compilation | 69 | /// Any information which should trigger invalidation of incremental compilation |
| 70 | /// data should be used to update this hasher. The result is the final source | 70 | /// data should be used to update this hasher. The result is the final source |
| 71 | /// hash of the enclosing declaration/etc. | 71 | /// hash of the enclosing declaration/etc. |
| ... | @@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 159 | 159 | ||
| 160 | var top_scope: Scope.Top = .{}; | 160 | var top_scope: Scope.Top = .{}; |
| 161 | 161 | ||
| 162 | var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; | 162 | var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; |
| 163 | var gen_scope: GenZir = .{ | 163 | var gen_scope: GenZir = .{ |
| 164 | .is_comptime = true, | 164 | .is_comptime = true, |
| 165 | .parent = &top_scope.base, | 165 | .parent = &top_scope.base, |
| ... | @@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi | ... | @@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi |
| 5854 | const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len); | 5854 | const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len); |
| 5855 | var fields_len: usize = 0; | 5855 | var fields_len: usize = 0; |
| 5856 | { | 5856 | { |
| 5857 | var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{}; | 5857 | var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty; |
| 5858 | defer idents.deinit(gpa); | 5858 | defer idents.deinit(gpa); |
| 5859 | 5859 | ||
| 5860 | const error_token = main_tokens[node]; | 5860 | const error_token = main_tokens[node]; |
| ... | @@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co | ... | @@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co |
| 11259 | if (!mem.startsWith(u8, ident_name, "@")) { | 11259 | if (!mem.startsWith(u8, ident_name, "@")) { |
| 11260 | return ident_name; | 11260 | return ident_name; |
| 11261 | } | 11261 | } |
| 11262 | var buf: ArrayListUnmanaged(u8) = .{}; | 11262 | var buf: ArrayListUnmanaged(u8) = .empty; |
| 11263 | defer buf.deinit(astgen.gpa); | 11263 | defer buf.deinit(astgen.gpa); |
| 11264 | try astgen.parseStrLit(token, &buf, ident_name, 1); | 11264 | try astgen.parseStrLit(token, &buf, ident_name, 1); |
| 11265 | if (mem.indexOfScalar(u8, buf.items, 0) != null) { | 11265 | if (mem.indexOfScalar(u8, buf.items, 0) != null) { |
| ... | @@ -11881,7 +11881,7 @@ const Scope = struct { | ... | @@ -11881,7 +11881,7 @@ const Scope = struct { |
| 11881 | parent: *Scope, | 11881 | parent: *Scope, |
| 11882 | /// Maps string table index to the source location of declaration, | 11882 | /// Maps string table index to the source location of declaration, |
| 11883 | /// for the purposes of reporting name shadowing compile errors. | 11883 | /// 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, |
| 11885 | node: Ast.Node.Index, | 11885 | node: Ast.Node.Index, |
| 11886 | inst: Zir.Inst.Index, | 11886 | inst: Zir.Inst.Index, |
| 11887 | maybe_generic: bool, | 11887 | maybe_generic: bool, |
| ... | @@ -11891,7 +11891,7 @@ const Scope = struct { | ... | @@ -11891,7 +11891,7 @@ const Scope = struct { |
| 11891 | declaring_gz: ?*GenZir, | 11891 | declaring_gz: ?*GenZir, |
| 11892 | 11892 | ||
| 11893 | /// Set of captures used by this namespace. | 11893 | /// Set of captures used by this namespace. |
| 11894 | captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .{}, | 11894 | captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .empty, |
| 11895 | 11895 | ||
| 11896 | fn deinit(self: *Namespace, gpa: Allocator) void { | 11896 | fn deinit(self: *Namespace, gpa: Allocator) void { |
| 11897 | self.decls.deinit(gpa); | 11897 | self.decls.deinit(gpa); |
| ... | @@ -13607,9 +13607,9 @@ fn scanContainer( | ... | @@ -13607,9 +13607,9 @@ fn scanContainer( |
| 13607 | var sfba_state = std.heap.stackFallback(512, astgen.gpa); | 13607 | var sfba_state = std.heap.stackFallback(512, astgen.gpa); |
| 13608 | const sfba = sfba_state.get(); | 13608 | const sfba = sfba_state.get(); |
| 13609 | 13609 | ||
| 13610 | var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; | 13610 | var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 13611 | var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; | 13611 | var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 13612 | var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{}; | 13612 | var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; |
| 13613 | defer { | 13613 | defer { |
| 13614 | names.deinit(sfba); | 13614 | names.deinit(sfba); |
| 13615 | test_names.deinit(sfba); | 13615 | test_names.deinit(sfba); |
| ... | @@ -13796,7 +13796,7 @@ fn scanContainer( | ... | @@ -13796,7 +13796,7 @@ fn scanContainer( |
| 13796 | 13796 | ||
| 13797 | for (names.keys(), names.values()) |name, first| { | 13797 | for (names.keys(), names.values()) |name, first| { |
| 13798 | if (first.next == null) continue; | 13798 | if (first.next == null) continue; |
| 13799 | var notes: std.ArrayListUnmanaged(u32) = .{}; | 13799 | var notes: std.ArrayListUnmanaged(u32) = .empty; |
| 13800 | var prev: NameEntry = first; | 13800 | var prev: NameEntry = first; |
| 13801 | while (prev.next) |cur| : (prev = cur.*) { | 13801 | while (prev.next) |cur| : (prev = cur.*) { |
| 13802 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{})); | 13802 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{})); |
| ... | @@ -13808,7 +13808,7 @@ fn scanContainer( | ... | @@ -13808,7 +13808,7 @@ fn scanContainer( |
| 13808 | 13808 | ||
| 13809 | for (test_names.keys(), test_names.values()) |name, first| { | 13809 | for (test_names.keys(), test_names.values()) |name, first| { |
| 13810 | if (first.next == null) continue; | 13810 | if (first.next == null) continue; |
| 13811 | var notes: std.ArrayListUnmanaged(u32) = .{}; | 13811 | var notes: std.ArrayListUnmanaged(u32) = .empty; |
| 13812 | var prev: NameEntry = first; | 13812 | var prev: NameEntry = first; |
| 13813 | while (prev.next) |cur| : (prev = cur.*) { | 13813 | while (prev.next) |cur| : (prev = cur.*) { |
| 13814 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{})); | 13814 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{})); |
| ... | @@ -13820,7 +13820,7 @@ fn scanContainer( | ... | @@ -13820,7 +13820,7 @@ fn scanContainer( |
| 13820 | 13820 | ||
| 13821 | for (decltest_names.keys(), decltest_names.values()) |name, first| { | 13821 | for (decltest_names.keys(), decltest_names.values()) |name, first| { |
| 13822 | if (first.next == null) continue; | 13822 | if (first.next == null) continue; |
| 13823 | var notes: std.ArrayListUnmanaged(u32) = .{}; | 13823 | var notes: std.ArrayListUnmanaged(u32) = .empty; |
| 13824 | var prev: NameEntry = first; | 13824 | var prev: NameEntry = first; |
| 13825 | while (prev.next) |cur| : (prev = cur.*) { | 13825 | while (prev.next) |cur| : (prev = cur.*) { |
| 13826 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{})); | 13826 | try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{})); |
| ... | @@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void { | ... | @@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void { |
| 13949 | const gpa = astgen.gpa; | 13949 | const gpa = astgen.gpa; |
| 13950 | const parse_err = tree.errors[0]; | 13950 | const parse_err = tree.errors[0]; |
| 13951 | 13951 | ||
| 13952 | var msg: std.ArrayListUnmanaged(u8) = .{}; | 13952 | var msg: std.ArrayListUnmanaged(u8) = .empty; |
| 13953 | defer msg.deinit(gpa); | 13953 | defer msg.deinit(gpa); |
| 13954 | 13954 | ||
| 13955 | var notes: std.ArrayListUnmanaged(u32) = .{}; | 13955 | var notes: std.ArrayListUnmanaged(u32) = .empty; |
| 13956 | defer notes.deinit(gpa); | 13956 | defer notes.deinit(gpa); |
| 13957 | 13957 | ||
| 13958 | for (tree.errors[1..]) |note| { | 13958 | for (tree.errors[1..]) |note| { |
lib/std/zig/ErrorBundle.zig+1-1| ... | @@ -571,7 +571,7 @@ pub const Wip = struct { | ... | @@ -571,7 +571,7 @@ pub const Wip = struct { |
| 571 | if (index == .none) return .none; | 571 | if (index == .none) return .none; |
| 572 | const other_sl = other.getSourceLocation(index); | 572 | const other_sl = other.getSourceLocation(index); |
| 573 | 573 | ||
| 574 | var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .{}; | 574 | var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .empty; |
| 575 | defer ref_traces.deinit(wip.gpa); | 575 | defer ref_traces.deinit(wip.gpa); |
| 576 | 576 | ||
| 577 | if (other_sl.reference_trace_len > 0) { | 577 | if (other_sl.reference_trace_len > 0) { |
lib/std/zig/WindowsSdk.zig+1-1| ... | @@ -751,7 +751,7 @@ const MsvcLibDir = struct { | ... | @@ -751,7 +751,7 @@ const MsvcLibDir = struct { |
| 751 | defer instances_dir.close(); | 751 | defer instances_dir.close(); |
| 752 | 752 | ||
| 753 | var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined; | 753 | 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; |
| 755 | errdefer latest_version_lib_dir.deinit(allocator); | 755 | errdefer latest_version_lib_dir.deinit(allocator); |
| 756 | 756 | ||
| 757 | var latest_version: u64 = 0; | 757 | 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 | ... | @@ -3711,7 +3711,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In |
| 3711 | 3711 | ||
| 3712 | // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse | 3712 | // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse |
| 3713 | // their contents once per defer. So, we store the extra index of the body here to deduplicate. | 3713 | // 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; |
| 3715 | defer found_defers.deinit(gpa); | 3715 | defer found_defers.deinit(gpa); |
| 3716 | 3716 | ||
| 3717 | try zir.findDeclsBody(gpa, list, &found_defers, bodies.value_body); | 3717 | 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 | ... | @@ -3725,7 +3725,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In |
| 3725 | pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void { | 3725 | pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void { |
| 3726 | list.clearRetainingCapacity(); | 3726 | list.clearRetainingCapacity(); |
| 3727 | 3727 | ||
| 3728 | var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{}; | 3728 | var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; |
| 3729 | defer found_defers.deinit(gpa); | 3729 | defer found_defers.deinit(gpa); |
| 3730 | 3730 | ||
| 3731 | try zir.findDeclsInner(gpa, list, &found_defers, .main_struct_inst); | 3731 | 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); | ... | @@ -17,21 +17,21 @@ const Ais = AutoIndentingStream(std.ArrayList(u8).Writer); |
| 17 | pub const Fixups = struct { | 17 | pub const Fixups = struct { |
| 18 | /// The key is the mut token (`var`/`const`) of the variable declaration | 18 | /// The key is the mut token (`var`/`const`) of the variable declaration |
| 19 | /// that should have a `_ = foo;` inserted afterwards. | 19 | /// 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, |
| 21 | /// The functions in this unordered set of AST fn decl nodes will render | 21 | /// The functions in this unordered set of AST fn decl nodes will render |
| 22 | /// with a function body of `@trap()` instead, with all parameters | 22 | /// with a function body of `@trap()` instead, with all parameters |
| 23 | /// discarded. | 23 | /// discarded. |
| 24 | gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{}, | 24 | gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty, |
| 25 | /// These global declarations will be omitted. | 25 | /// 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, |
| 27 | /// These expressions will be replaced with the string value. | 27 | /// 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, |
| 29 | /// The string value will be inserted directly after the node. | 29 | /// 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, |
| 31 | /// These nodes will be replaced with a different node. | 31 | /// 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, |
| 33 | /// Change all identifier names matching the key to be value instead. | 33 | /// 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, |
| 35 | 35 | ||
| 36 | /// All `@import` builtin calls which refer to a file path will be prefixed | 36 | /// All `@import` builtin calls which refer to a file path will be prefixed |
| 37 | /// with this path. | 37 | /// with this path. |
lib/std/zig/system/NativePaths.zig+5-5| ... | @@ -7,11 +7,11 @@ const mem = std.mem; | ... | @@ -7,11 +7,11 @@ const mem = std.mem; |
| 7 | const NativePaths = @This(); | 7 | const NativePaths = @This(); |
| 8 | 8 | ||
| 9 | arena: Allocator, | 9 | arena: Allocator, |
| 10 | include_dirs: std.ArrayListUnmanaged([]const u8) = .{}, | 10 | include_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 11 | lib_dirs: std.ArrayListUnmanaged([]const u8) = .{}, | 11 | lib_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 12 | framework_dirs: std.ArrayListUnmanaged([]const u8) = .{}, | 12 | framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty, |
| 13 | rpaths: std.ArrayListUnmanaged([]const u8) = .{}, | 13 | rpaths: std.ArrayListUnmanaged([]const u8) = .empty, |
| 14 | warnings: std.ArrayListUnmanaged([]const u8) = .{}, | 14 | warnings: std.ArrayListUnmanaged([]const u8) = .empty, |
| 15 | 15 | ||
| 16 | pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { | 16 | pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths { |
| 17 | var self: NativePaths = .{ .arena = arena }; | 17 | var self: NativePaths = .{ .arena = arena }; |
src/Compilation.zig+23-23| ... | @@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8, | ... | @@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8, |
| 95 | /// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE. | 95 | /// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE. |
| 96 | force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), | 96 | force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), |
| 97 | 97 | ||
| 98 | c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{}, | 98 | c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty, |
| 99 | win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { | 99 | win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { |
| 100 | pub fn keys(_: @This()) [0]void { | 100 | pub fn keys(_: @This()) [0]void { |
| 101 | return .{}; | 101 | return .{}; |
| ... | @@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa | ... | @@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa |
| 106 | pub fn deinit(_: @This(), _: Allocator) void {} | 106 | pub fn deinit(_: @This(), _: Allocator) void {} |
| 107 | } = .{}, | 107 | } = .{}, |
| 108 | 108 | ||
| 109 | link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{}, | 109 | link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .empty, |
| 110 | link_errors_mutex: std.Thread.Mutex = .{}, | 110 | link_errors_mutex: std.Thread.Mutex = .{}, |
| 111 | link_error_flags: link.File.ErrorFlags = .{}, | 111 | link_error_flags: link.File.ErrorFlags = .{}, |
| 112 | lld_errors: std.ArrayListUnmanaged(LldError) = .{}, | 112 | lld_errors: std.ArrayListUnmanaged(LldError) = .empty, |
| 113 | 113 | ||
| 114 | work_queues: [ | 114 | work_queues: [ |
| 115 | len: { | 115 | len: { |
| ... | @@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic), | ... | @@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic), |
| 154 | 154 | ||
| 155 | /// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator. | 155 | /// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator. |
| 156 | /// This data is accessed by multiple threads and is protected by `mutex`. | 156 | /// This data is accessed by multiple threads and is protected by `mutex`. |
| 157 | failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .{}, | 157 | failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty, |
| 158 | 158 | ||
| 159 | /// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator. | 159 | /// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator. |
| 160 | /// This data is accessed by multiple threads and is protected by `mutex`. | 160 | /// 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 | ... | @@ -166,7 +166,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash |
| 166 | } = .{}, | 166 | } = .{}, |
| 167 | 167 | ||
| 168 | /// Miscellaneous things that can fail. | 168 | /// Miscellaneous things that can fail. |
| 169 | misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .{}, | 169 | misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty, |
| 170 | 170 | ||
| 171 | /// When this is `true` it means invoking clang as a sub-process is expected to inherit | 171 | /// When this is `true` it means invoking clang as a sub-process is expected to inherit |
| 172 | /// stdin, stdout, stderr, and if it returns non success, to forward the exit code. | 172 | /// 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, | ... | @@ -248,7 +248,7 @@ wasi_emulated_libs: []const wasi_libc.CRTFile, |
| 248 | /// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source, | 248 | /// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source, |
| 249 | /// The set of needed CRT (C runtime) files differs depending on the target and compilation settings. | 249 | /// The set of needed CRT (C runtime) files differs depending on the target and compilation settings. |
| 250 | /// The key is the basename, and the value is the absolute path to the completed build artifact. | 250 | /// The key is the basename, and the value is the absolute path to the completed build artifact. |
| 251 | crt_files: std.StringHashMapUnmanaged(CRTFile) = .{}, | 251 | crt_files: std.StringHashMapUnmanaged(CRTFile) = .empty, |
| 252 | 252 | ||
| 253 | /// How many lines of reference trace should be included per compile error. | 253 | /// How many lines of reference trace should be included per compile error. |
| 254 | /// Null means only show snippet on first error. | 254 | /// Null means only show snippet on first error. |
| ... | @@ -527,8 +527,8 @@ pub const CObject = struct { | ... | @@ -527,8 +527,8 @@ pub const CObject = struct { |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | pub const Bundle = struct { | 529 | pub const Bundle = struct { |
| 530 | file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, | 530 | file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, |
| 531 | category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, | 531 | category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, |
| 532 | diags: []Diag = &.{}, | 532 | diags: []Diag = &.{}, |
| 533 | 533 | ||
| 534 | pub fn destroy(bundle: *Bundle, gpa: Allocator) void { | 534 | pub fn destroy(bundle: *Bundle, gpa: Allocator) void { |
| ... | @@ -561,8 +561,8 @@ pub const CObject = struct { | ... | @@ -561,8 +561,8 @@ pub const CObject = struct { |
| 561 | category: u32 = 0, | 561 | category: u32 = 0, |
| 562 | msg: []const u8 = &.{}, | 562 | msg: []const u8 = &.{}, |
| 563 | src_loc: SrcLoc = .{}, | 563 | src_loc: SrcLoc = .{}, |
| 564 | src_ranges: std.ArrayListUnmanaged(SrcRange) = .{}, | 564 | src_ranges: std.ArrayListUnmanaged(SrcRange) = .empty, |
| 565 | sub_diags: std.ArrayListUnmanaged(Diag) = .{}, | 565 | sub_diags: std.ArrayListUnmanaged(Diag) = .empty, |
| 566 | 566 | ||
| 567 | fn deinit(wip_diag: *@This(), allocator: Allocator) void { | 567 | fn deinit(wip_diag: *@This(), allocator: Allocator) void { |
| 568 | allocator.free(wip_diag.msg); | 568 | allocator.free(wip_diag.msg); |
| ... | @@ -580,19 +580,19 @@ pub const CObject = struct { | ... | @@ -580,19 +580,19 @@ pub const CObject = struct { |
| 580 | var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() }); | 580 | var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() }); |
| 581 | defer bc.deinit(); | 581 | defer bc.deinit(); |
| 582 | 582 | ||
| 583 | var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; | 583 | var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; |
| 584 | errdefer { | 584 | errdefer { |
| 585 | for (file_names.values()) |file_name| gpa.free(file_name); | 585 | for (file_names.values()) |file_name| gpa.free(file_name); |
| 586 | file_names.deinit(gpa); | 586 | file_names.deinit(gpa); |
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; | 589 | var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; |
| 590 | errdefer { | 590 | errdefer { |
| 591 | for (category_names.values()) |category_name| gpa.free(category_name); | 591 | for (category_names.values()) |category_name| gpa.free(category_name); |
| 592 | category_names.deinit(gpa); | 592 | category_names.deinit(gpa); |
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | var stack: std.ArrayListUnmanaged(WipDiag) = .{}; | 595 | var stack: std.ArrayListUnmanaged(WipDiag) = .empty; |
| 596 | defer { | 596 | defer { |
| 597 | for (stack.items) |*wip_diag| wip_diag.deinit(gpa); | 597 | for (stack.items) |*wip_diag| wip_diag.deinit(gpa); |
| 598 | stack.deinit(gpa); | 598 | stack.deinit(gpa); |
| ... | @@ -1067,7 +1067,7 @@ pub const CreateOptions = struct { | ... | @@ -1067,7 +1067,7 @@ pub const CreateOptions = struct { |
| 1067 | cache_mode: CacheMode = .incremental, | 1067 | cache_mode: CacheMode = .incremental, |
| 1068 | lib_dirs: []const []const u8 = &[0][]const u8{}, | 1068 | lib_dirs: []const []const u8 = &[0][]const u8{}, |
| 1069 | rpath_list: []const []const u8 = &[0][]const u8{}, | 1069 | rpath_list: []const []const u8 = &[0][]const u8{}, |
| 1070 | symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}, | 1070 | symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 1071 | c_source_files: []const CSourceFile = &.{}, | 1071 | c_source_files: []const CSourceFile = &.{}, |
| 1072 | rc_source_files: []const RcSourceFile = &.{}, | 1072 | rc_source_files: []const RcSourceFile = &.{}, |
| 1073 | manifest_file: ?[]const u8 = null, | 1073 | manifest_file: ?[]const u8 = null, |
| ... | @@ -1155,7 +1155,7 @@ pub const CreateOptions = struct { | ... | @@ -1155,7 +1155,7 @@ pub const CreateOptions = struct { |
| 1155 | skip_linker_dependencies: bool = false, | 1155 | skip_linker_dependencies: bool = false, |
| 1156 | hash_style: link.File.Elf.HashStyle = .both, | 1156 | hash_style: link.File.Elf.HashStyle = .both, |
| 1157 | entry: Entry = .default, | 1157 | entry: Entry = .default, |
| 1158 | force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}, | 1158 | force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 1159 | stack_size: ?u64 = null, | 1159 | stack_size: ?u64 = null, |
| 1160 | image_base: ?u64 = null, | 1160 | image_base: ?u64 = null, |
| 1161 | version: ?std.SemanticVersion = null, | 1161 | version: ?std.SemanticVersion = null, |
| ... | @@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash( | ... | @@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash( |
| 1210 | main_mod: *Package.Module, | 1210 | main_mod: *Package.Module, |
| 1211 | hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, | 1211 | hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, |
| 1212 | ) (error{OutOfMemory} || std.process.GetCwdError)!void { | 1212 | ) (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; |
| 1214 | defer seen_table.deinit(gpa); | 1214 | defer seen_table.deinit(gpa); |
| 1215 | 1215 | ||
| 1216 | // root_mod and main_mod may be the same pointer. In fact they usually are. | 1216 | // root_mod and main_mod may be the same pointer. In fact they usually are. |
| ... | @@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg( | ... | @@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg( |
| 3362 | const file_path = try err_src_loc.file_scope.fullPath(gpa); | 3362 | const file_path = try err_src_loc.file_scope.fullPath(gpa); |
| 3363 | defer gpa.free(file_path); | 3363 | defer gpa.free(file_path); |
| 3364 | 3364 | ||
| 3365 | var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .{}; | 3365 | var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .empty; |
| 3366 | defer ref_traces.deinit(gpa); | 3366 | defer ref_traces.deinit(gpa); |
| 3367 | 3367 | ||
| 3368 | if (module_err_msg.reference_trace_root.unwrap()) |rt_root| { | 3368 | if (module_err_msg.reference_trace_root.unwrap()) |rt_root| { |
| ... | @@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg( | ... | @@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg( |
| 3370 | all_references.* = try mod.resolveReferences(); | 3370 | all_references.* = try mod.resolveReferences(); |
| 3371 | } | 3371 | } |
| 3372 | 3372 | ||
| 3373 | var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .{}; | 3373 | var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .empty; |
| 3374 | defer seen.deinit(gpa); | 3374 | defer seen.deinit(gpa); |
| 3375 | 3375 | ||
| 3376 | const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len; | 3376 | const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len; |
| ... | @@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg( | ... | @@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg( |
| 3439 | 3439 | ||
| 3440 | // De-duplicate error notes. The main use case in mind for this is | 3440 | // De-duplicate error notes. The main use case in mind for this is |
| 3441 | // too many "note: called from here" notes when eval branch quota is reached. | 3441 | // 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; |
| 3443 | defer notes.deinit(gpa); | 3443 | defer notes.deinit(gpa); |
| 3444 | 3444 | ||
| 3445 | for (module_err_msg.notes) |module_note| { | 3445 | for (module_err_msg.notes) |module_note| { |
| ... | @@ -3544,7 +3544,7 @@ fn performAllTheWorkInner( | ... | @@ -3544,7 +3544,7 @@ fn performAllTheWorkInner( |
| 3544 | comp.job_queued_update_builtin_zig = false; | 3544 | comp.job_queued_update_builtin_zig = false; |
| 3545 | if (comp.zcu == null) break :b; | 3545 | if (comp.zcu == null) break :b; |
| 3546 | // TODO put all the modules in a flat array to make them easy to iterate. | 3546 | // 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; |
| 3548 | defer seen.deinit(comp.gpa); | 3548 | defer seen.deinit(comp.gpa); |
| 3549 | try seen.put(comp.gpa, comp.root_mod, {}); | 3549 | try seen.put(comp.gpa, comp.root_mod, {}); |
| 3550 | var i: usize = 0; | 3550 | var i: usize = 0; |
| ... | @@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { | ... | @@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { |
| 4026 | }; | 4026 | }; |
| 4027 | defer tar_file.close(); | 4027 | defer tar_file.close(); |
| 4028 | 4028 | ||
| 4029 | var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .{}; | 4029 | var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty; |
| 4030 | defer seen_table.deinit(comp.gpa); | 4030 | defer seen_table.deinit(comp.gpa); |
| 4031 | 4031 | ||
| 4032 | try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name); | 4032 | try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name); |
| ... | @@ -5221,7 +5221,7 @@ fn spawnZigRc( | ... | @@ -5221,7 +5221,7 @@ fn spawnZigRc( |
| 5221 | argv: []const []const u8, | 5221 | argv: []const []const u8, |
| 5222 | child_progress_node: std.Progress.Node, | 5222 | child_progress_node: std.Progress.Node, |
| 5223 | ) !void { | 5223 | ) !void { |
| 5224 | var node_name: std.ArrayListUnmanaged(u8) = .{}; | 5224 | var node_name: std.ArrayListUnmanaged(u8) = .empty; |
| 5225 | defer node_name.deinit(arena); | 5225 | defer node_name.deinit(arena); |
| 5226 | 5226 | ||
| 5227 | var child = std.process.Child.init(argv, arena); | 5227 | var child = std.process.Child.init(argv, arena); |
| ... | @@ -5540,7 +5540,7 @@ pub fn addCCArgs( | ... | @@ -5540,7 +5540,7 @@ pub fn addCCArgs( |
| 5540 | } | 5540 | } |
| 5541 | 5541 | ||
| 5542 | { | 5542 | { |
| 5543 | var san_arg: std.ArrayListUnmanaged(u8) = .{}; | 5543 | var san_arg: std.ArrayListUnmanaged(u8) = .empty; |
| 5544 | const prefix = "-fsanitize="; | 5544 | const prefix = "-fsanitize="; |
| 5545 | if (mod.sanitize_c) { | 5545 | if (mod.sanitize_c) { |
| 5546 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); | 5546 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); |
src/InternPool.zig+35-17| ... | @@ -2,20 +2,20 @@ | ... | @@ -2,20 +2,20 @@ |
| 2 | //! This data structure is self-contained. | 2 | //! This data structure is self-contained. |
| 3 | 3 | ||
| 4 | /// One item per thread, indexed by `tid`, which is dense and unique per thread. | 4 | /// One item per thread, indexed by `tid`, which is dense and unique per thread. |
| 5 | locals: []Local = &.{}, | 5 | locals: []Local, |
| 6 | /// Length must be a power of two and represents the number of simultaneous | 6 | /// Length must be a power of two and represents the number of simultaneous |
| 7 | /// writers that can mutate any single sharded data structure. | 7 | /// writers that can mutate any single sharded data structure. |
| 8 | shards: []Shard = &.{}, | 8 | shards: []Shard, |
| 9 | /// Key is the error name, index is the error tag value. Index 0 has a length-0 string. | 9 | /// Key is the error name, index is the error tag value. Index 0 has a length-0 string. |
| 10 | global_error_set: GlobalErrorSet = GlobalErrorSet.empty, | 10 | global_error_set: GlobalErrorSet, |
| 11 | /// Cached number of active bits in a `tid`. | 11 | /// Cached number of active bits in a `tid`. |
| 12 | tid_width: if (single_threaded) u0 else std.math.Log2Int(u32) = 0, | 12 | tid_width: if (single_threaded) u0 else std.math.Log2Int(u32), |
| 13 | /// Cached shift amount to put a `tid` in the top bits of a 30-bit value. | 13 | /// Cached shift amount to put a `tid` in the top bits of a 30-bit value. |
| 14 | tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, | 14 | tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32), |
| 15 | /// Cached shift amount to put a `tid` in the top bits of a 31-bit value. | 15 | /// Cached shift amount to put a `tid` in the top bits of a 31-bit value. |
| 16 | tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, | 16 | tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32), |
| 17 | /// Cached shift amount to put a `tid` in the top bits of a 32-bit value. | 17 | /// Cached shift amount to put a `tid` in the top bits of a 32-bit value. |
| 18 | tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, | 18 | tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32), |
| 19 | 19 | ||
| 20 | /// Dependencies on the source code hash associated with a ZIR instruction. | 20 | /// Dependencies on the source code hash associated with a ZIR instruction. |
| 21 | /// * For a `declaration`, this is the entire declaration body. | 21 | /// * 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 | ... | @@ -23,36 +23,36 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_th |
| 23 | /// * For a `func`, this is the source of the full function signature. | 23 | /// * For a `func`, this is the source of the full function signature. |
| 24 | /// These are also invalidated if tracking fails for this instruction. | 24 | /// These are also invalidated if tracking fails for this instruction. |
| 25 | /// Value is index into `dep_entries` of the first dependency on this hash. | 25 | /// Value is index into `dep_entries` of the first dependency on this hash. |
| 26 | src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, | 26 | src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), |
| 27 | /// Dependencies on the value of a Nav. | 27 | /// Dependencies on the value of a Nav. |
| 28 | /// Value is index into `dep_entries` of the first dependency on this Nav value. | 28 | /// Value is index into `dep_entries` of the first dependency on this Nav value. |
| 29 | nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .{}, | 29 | nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index), |
| 30 | /// Dependencies on an interned value, either: | 30 | /// Dependencies on an interned value, either: |
| 31 | /// * a runtime function (invalidated when its IES changes) | 31 | /// * a runtime function (invalidated when its IES changes) |
| 32 | /// * a container type requiring resolution (invalidated when the type must be recreated at a new index) | 32 | /// * a container type requiring resolution (invalidated when the type must be recreated at a new index) |
| 33 | /// Value is index into `dep_entries` of the first dependency on this interned value. | 33 | /// Value is index into `dep_entries` of the first dependency on this interned value. |
| 34 | interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .{}, | 34 | interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), |
| 35 | /// Dependencies on the full set of names in a ZIR namespace. | 35 | /// Dependencies on the full set of names in a ZIR namespace. |
| 36 | /// Key refers to a `struct_decl`, `union_decl`, etc. | 36 | /// Key refers to a `struct_decl`, `union_decl`, etc. |
| 37 | /// Value is index into `dep_entries` of the first dependency on this namespace. | 37 | /// Value is index into `dep_entries` of the first dependency on this namespace. |
| 38 | namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, | 38 | namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), |
| 39 | /// Dependencies on the (non-)existence of some name in a namespace. | 39 | /// Dependencies on the (non-)existence of some name in a namespace. |
| 40 | /// Value is index into `dep_entries` of the first dependency on this name. | 40 | /// Value is index into `dep_entries` of the first dependency on this name. |
| 41 | namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .{}, | 41 | namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index), |
| 42 | 42 | ||
| 43 | /// Given a `Depender`, points to an entry in `dep_entries` whose `depender` | 43 | /// Given a `Depender`, points to an entry in `dep_entries` whose `depender` |
| 44 | /// matches. The `next_dependee` field can be used to iterate all such entries | 44 | /// matches. The `next_dependee` field can be used to iterate all such entries |
| 45 | /// and remove them from the corresponding lists. | 45 | /// and remove them from the corresponding lists. |
| 46 | first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .{}, | 46 | first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index), |
| 47 | 47 | ||
| 48 | /// Stores dependency information. The hashmaps declared above are used to look | 48 | /// Stores dependency information. The hashmaps declared above are used to look |
| 49 | /// up entries in this list as required. This is not stored in `extra` so that | 49 | /// up entries in this list as required. This is not stored in `extra` so that |
| 50 | /// we can use `free_dep_entries` to track free indices, since dependencies are | 50 | /// we can use `free_dep_entries` to track free indices, since dependencies are |
| 51 | /// removed frequently. | 51 | /// removed frequently. |
| 52 | dep_entries: std.ArrayListUnmanaged(DepEntry) = .{}, | 52 | dep_entries: std.ArrayListUnmanaged(DepEntry), |
| 53 | /// Stores unused indices in `dep_entries` which can be reused without a full | 53 | /// Stores unused indices in `dep_entries` which can be reused without a full |
| 54 | /// garbage collection pass. | 54 | /// garbage collection pass. |
| 55 | free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .{}, | 55 | free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index), |
| 56 | 56 | ||
| 57 | /// Whether a multi-threaded intern pool is useful. | 57 | /// Whether a multi-threaded intern pool is useful. |
| 58 | /// Currently `false` until the intern pool is actually accessed | 58 | /// Currently `false` until the intern pool is actually accessed |
| ... | @@ -62,6 +62,24 @@ const want_multi_threaded = true; | ... | @@ -62,6 +62,24 @@ const want_multi_threaded = true; |
| 62 | /// Whether a single-threaded intern pool impl is in use. | 62 | /// Whether a single-threaded intern pool impl is in use. |
| 63 | pub const single_threaded = builtin.single_threaded or !want_multi_threaded; | 63 | pub const single_threaded = builtin.single_threaded or !want_multi_threaded; |
| 64 | 64 | ||
| 65 | pub 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 | |||
| 65 | /// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole | 83 | /// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole |
| 66 | /// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both | 84 | /// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both |
| 67 | /// the file which the instruction lives in, and the instruction index itself, which is updated on | 85 | /// 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 { | ... | @@ -9858,7 +9876,7 @@ fn extraData(extra: Local.Extra, comptime T: type, index: u32) T { |
| 9858 | test "basic usage" { | 9876 | test "basic usage" { |
| 9859 | const gpa = std.testing.allocator; | 9877 | const gpa = std.testing.allocator; |
| 9860 | 9878 | ||
| 9861 | var ip: InternPool = .{}; | 9879 | var ip: InternPool = .empty; |
| 9862 | defer ip.deinit(gpa); | 9880 | defer ip.deinit(gpa); |
| 9863 | 9881 | ||
| 9864 | const i32_type = try ip.get(gpa, .main, .{ .int_type = .{ | 9882 | const i32_type = try ip.get(gpa, .main, .{ .int_type = .{ |
| ... | @@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) | ... | @@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) |
| 10791 | var bw = std.io.bufferedWriter(std.io.getStdErr().writer()); | 10809 | var bw = std.io.bufferedWriter(std.io.getStdErr().writer()); |
| 10792 | const w = bw.writer(); | 10810 | const w = bw.writer(); |
| 10793 | 10811 | ||
| 10794 | var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .{}; | 10812 | var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .empty; |
| 10795 | for (ip.locals, 0..) |*local, tid| { | 10813 | for (ip.locals, 0..) |*local, tid| { |
| 10796 | const items = local.shared.items.view().slice(); | 10814 | const items = local.shared.items.view().slice(); |
| 10797 | const extra_list = local.shared.extra; | 10815 | const extra_list = local.shared.extra; |
src/Liveness.zig+9-9| ... | @@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type { | ... | @@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type { |
| 94 | /// body and which we are currently within. Also includes `loop`s which are the target | 94 | /// body and which we are currently within. Also includes `loop`s which are the target |
| 95 | /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a | 95 | /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a |
| 96 | /// `switch_dispatch` instruction. | 96 | /// `switch_dispatch` instruction. |
| 97 | breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, | 97 | breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, |
| 98 | 98 | ||
| 99 | /// The set of operands for which we have seen at least one usage but not their birth. | 99 | /// 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, |
| 101 | 101 | ||
| 102 | fn deinit(self: *@This(), gpa: Allocator) void { | 102 | fn deinit(self: *@This(), gpa: Allocator) void { |
| 103 | self.breaks.deinit(gpa); | 103 | self.breaks.deinit(gpa); |
| ... | @@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type { | ... | @@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type { |
| 107 | 107 | ||
| 108 | .main_analysis => struct { | 108 | .main_analysis => struct { |
| 109 | /// Every `block` and `loop` currently under analysis. | 109 | /// 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, |
| 111 | 111 | ||
| 112 | /// The set of instructions currently alive in the current control | 112 | /// The set of instructions currently alive in the current control |
| 113 | /// flow branch. | 113 | /// flow branch. |
| 114 | live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, | 114 | live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, |
| 115 | 115 | ||
| 116 | /// The extra data initialized by the `loop_analysis` pass for this pass to consume. | 116 | /// The extra data initialized by the `loop_analysis` pass for this pass to consume. |
| 117 | /// Owned by this struct during this pass. | 117 | /// Owned by this struct during this pass. |
| 118 | old_extra: std.ArrayListUnmanaged(u32) = .{}, | 118 | old_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 119 | 119 | ||
| 120 | const BlockScope = struct { | 120 | const BlockScope = struct { |
| 121 | /// If this is a `block`, these instructions are alive upon a `br` to this block. | 121 | /// If this is a `block`, these instructions are alive upon a `br` to this block. |
| ... | @@ -1710,10 +1710,10 @@ fn analyzeInstCondBr( | ... | @@ -1710,10 +1710,10 @@ fn analyzeInstCondBr( |
| 1710 | // Operands which are alive in one branch but not the other need to die at the start of | 1710 | // Operands which are alive in one branch but not the other need to die at the start of |
| 1711 | // the peer branch. | 1711 | // the peer branch. |
| 1712 | 1712 | ||
| 1713 | var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; | 1713 | var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; |
| 1714 | defer then_mirrored_deaths.deinit(gpa); | 1714 | defer then_mirrored_deaths.deinit(gpa); |
| 1715 | 1715 | ||
| 1716 | var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; | 1716 | var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; |
| 1717 | defer else_mirrored_deaths.deinit(gpa); | 1717 | defer else_mirrored_deaths.deinit(gpa); |
| 1718 | 1718 | ||
| 1719 | // Note: this invalidates `else_live`, but expands `then_live` to be their union | 1719 | // Note: this invalidates `else_live`, but expands `then_live` to be their union |
| ... | @@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr( | ... | @@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr( |
| 1785 | 1785 | ||
| 1786 | switch (pass) { | 1786 | switch (pass) { |
| 1787 | .loop_analysis => { | 1787 | .loop_analysis => { |
| 1788 | var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; | 1788 | var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; |
| 1789 | defer old_breaks.deinit(gpa); | 1789 | defer old_breaks.deinit(gpa); |
| 1790 | 1790 | ||
| 1791 | var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; | 1791 | var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; |
| 1792 | defer old_live.deinit(gpa); | 1792 | defer old_live.deinit(gpa); |
| 1793 | 1793 | ||
| 1794 | if (is_dispatch_loop) { | 1794 | if (is_dispatch_loop) { |
src/Liveness/Verify.zig+2-2| ... | @@ -4,8 +4,8 @@ gpa: std.mem.Allocator, | ... | @@ -4,8 +4,8 @@ gpa: std.mem.Allocator, |
| 4 | air: Air, | 4 | air: Air, |
| 5 | liveness: Liveness, | 5 | liveness: Liveness, |
| 6 | live: LiveMap = .{}, | 6 | live: LiveMap = .{}, |
| 7 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, | 7 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, |
| 8 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, | 8 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, |
| 9 | intern_pool: *const InternPool, | 9 | intern_pool: *const InternPool, |
| 10 | 10 | ||
| 11 | pub const Error = error{ LivenessInvalid, OutOfMemory }; | 11 | pub const Error = error{ LivenessInvalid, OutOfMemory }; |
src/Package/Fetch.zig+4-4| ... | @@ -91,7 +91,7 @@ pub const JobQueue = struct { | ... | @@ -91,7 +91,7 @@ pub const JobQueue = struct { |
| 91 | /// `table` may be missing some tasks such as ones that failed, so this | 91 | /// `table` may be missing some tasks such as ones that failed, so this |
| 92 | /// field contains references to all of them. | 92 | /// field contains references to all of them. |
| 93 | /// Protected by `mutex`. | 93 | /// Protected by `mutex`. |
| 94 | all_fetches: std.ArrayListUnmanaged(*Fetch) = .{}, | 94 | all_fetches: std.ArrayListUnmanaged(*Fetch) = .empty, |
| 95 | 95 | ||
| 96 | http_client: *std.http.Client, | 96 | http_client: *std.http.Client, |
| 97 | thread_pool: *ThreadPool, | 97 | thread_pool: *ThreadPool, |
| ... | @@ -1439,7 +1439,7 @@ fn computeHash( | ... | @@ -1439,7 +1439,7 @@ fn computeHash( |
| 1439 | 1439 | ||
| 1440 | // Track directories which had any files deleted from them so that empty directories | 1440 | // Track directories which had any files deleted from them so that empty directories |
| 1441 | // can be deleted. | 1441 | // can be deleted. |
| 1442 | var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{}; | 1442 | var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty; |
| 1443 | defer sus_dirs.deinit(gpa); | 1443 | defer sus_dirs.deinit(gpa); |
| 1444 | 1444 | ||
| 1445 | var walker = try root_dir.walk(gpa); | 1445 | var walker = try root_dir.walk(gpa); |
| ... | @@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void { | ... | @@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void { |
| 1710 | } | 1710 | } |
| 1711 | 1711 | ||
| 1712 | const Filter = struct { | 1712 | const Filter = struct { |
| 1713 | include_paths: std.StringArrayHashMapUnmanaged(void) = .{}, | 1713 | include_paths: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 1714 | 1714 | ||
| 1715 | /// sub_path is relative to the package root. | 1715 | /// sub_path is relative to the package root. |
| 1716 | pub fn includePath(self: Filter, sub_path: []const u8) bool { | 1716 | pub fn includePath(self: Filter, sub_path: []const u8) bool { |
| ... | @@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct { | ... | @@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct { |
| 2309 | var package_dir = try self.packageDir(); | 2309 | var package_dir = try self.packageDir(); |
| 2310 | defer package_dir.close(); | 2310 | defer package_dir.close(); |
| 2311 | 2311 | ||
| 2312 | var actual_files: std.ArrayListUnmanaged([]u8) = .{}; | 2312 | var actual_files: std.ArrayListUnmanaged([]u8) = .empty; |
| 2313 | defer actual_files.deinit(std.testing.allocator); | 2313 | defer actual_files.deinit(std.testing.allocator); |
| 2314 | defer for (actual_files.items) |file| std.testing.allocator.free(file); | 2314 | defer for (actual_files.items) |file| std.testing.allocator.free(file); |
| 2315 | var walker = try package_dir.walk(std.testing.allocator); | 2315 | var walker = try package_dir.walk(std.testing.allocator); |
src/Package/Fetch/git.zig+11-11| ... | @@ -38,7 +38,7 @@ test parseOid { | ... | @@ -38,7 +38,7 @@ test parseOid { |
| 38 | 38 | ||
| 39 | pub const Diagnostics = struct { | 39 | pub const Diagnostics = struct { |
| 40 | allocator: Allocator, | 40 | allocator: Allocator, |
| 41 | errors: std.ArrayListUnmanaged(Error) = .{}, | 41 | errors: std.ArrayListUnmanaged(Error) = .empty, |
| 42 | 42 | ||
| 43 | pub const Error = union(enum) { | 43 | pub const Error = union(enum) { |
| 44 | unable_to_create_sym_link: struct { | 44 | unable_to_create_sym_link: struct { |
| ... | @@ -263,7 +263,7 @@ const Odb = struct { | ... | @@ -263,7 +263,7 @@ const Odb = struct { |
| 263 | fn readObject(odb: *Odb) !Object { | 263 | fn readObject(odb: *Odb) !Object { |
| 264 | var base_offset = try odb.pack_file.getPos(); | 264 | var base_offset = try odb.pack_file.getPos(); |
| 265 | var base_header: EntryHeader = undefined; | 265 | var base_header: EntryHeader = undefined; |
| 266 | var delta_offsets = std.ArrayListUnmanaged(u64){}; | 266 | var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; |
| 267 | defer delta_offsets.deinit(odb.allocator); | 267 | defer delta_offsets.deinit(odb.allocator); |
| 268 | const base_object = while (true) { | 268 | const base_object = while (true) { |
| 269 | if (odb.cache.get(base_offset)) |base_object| break base_object; | 269 | if (odb.cache.get(base_offset)) |base_object| break base_object; |
| ... | @@ -361,7 +361,7 @@ const Object = struct { | ... | @@ -361,7 +361,7 @@ const Object = struct { |
| 361 | /// freed by the caller at any point after inserting it into the cache. Any | 361 | /// freed by the caller at any point after inserting it into the cache. Any |
| 362 | /// objects remaining in the cache will be freed when the cache itself is freed. | 362 | /// objects remaining in the cache will be freed when the cache itself is freed. |
| 363 | const ObjectCache = struct { | 363 | const ObjectCache = struct { |
| 364 | objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .{}, | 364 | objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .empty, |
| 365 | lru_nodes: LruList = .{}, | 365 | lru_nodes: LruList = .{}, |
| 366 | byte_size: usize = 0, | 366 | byte_size: usize = 0, |
| 367 | 367 | ||
| ... | @@ -660,7 +660,7 @@ pub const Session = struct { | ... | @@ -660,7 +660,7 @@ pub const Session = struct { |
| 660 | upload_pack_uri.query = null; | 660 | upload_pack_uri.query = null; |
| 661 | upload_pack_uri.fragment = null; | 661 | upload_pack_uri.fragment = null; |
| 662 | 662 | ||
| 663 | var body = std.ArrayListUnmanaged(u8){}; | 663 | var body: std.ArrayListUnmanaged(u8) = .empty; |
| 664 | defer body.deinit(allocator); | 664 | defer body.deinit(allocator); |
| 665 | const body_writer = body.writer(allocator); | 665 | const body_writer = body.writer(allocator); |
| 666 | try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer); | 666 | try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer); |
| ... | @@ -767,7 +767,7 @@ pub const Session = struct { | ... | @@ -767,7 +767,7 @@ pub const Session = struct { |
| 767 | upload_pack_uri.query = null; | 767 | upload_pack_uri.query = null; |
| 768 | upload_pack_uri.fragment = null; | 768 | upload_pack_uri.fragment = null; |
| 769 | 769 | ||
| 770 | var body = std.ArrayListUnmanaged(u8){}; | 770 | var body: std.ArrayListUnmanaged(u8) = .empty; |
| 771 | defer body.deinit(allocator); | 771 | defer body.deinit(allocator); |
| 772 | const body_writer = body.writer(allocator); | 772 | const body_writer = body.writer(allocator); |
| 773 | try Packet.write(.{ .data = "command=fetch\n" }, body_writer); | 773 | try Packet.write(.{ .data = "command=fetch\n" }, body_writer); |
| ... | @@ -1044,9 +1044,9 @@ const IndexEntry = struct { | ... | @@ -1044,9 +1044,9 @@ const IndexEntry = struct { |
| 1044 | pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void { | 1044 | pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void { |
| 1045 | try pack.seekTo(0); | 1045 | try pack.seekTo(0); |
| 1046 | 1046 | ||
| 1047 | var index_entries = std.AutoHashMapUnmanaged(Oid, IndexEntry){}; | 1047 | var index_entries: std.AutoHashMapUnmanaged(Oid, IndexEntry) = .empty; |
| 1048 | defer index_entries.deinit(allocator); | 1048 | defer index_entries.deinit(allocator); |
| 1049 | var pending_deltas = std.ArrayListUnmanaged(IndexEntry){}; | 1049 | var pending_deltas: std.ArrayListUnmanaged(IndexEntry) = .empty; |
| 1050 | defer pending_deltas.deinit(allocator); | 1050 | defer pending_deltas.deinit(allocator); |
| 1051 | 1051 | ||
| 1052 | const pack_checksum = try indexPackFirstPass(allocator, pack, &index_entries, &pending_deltas); | 1052 | 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) | ... | @@ -1068,7 +1068,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) |
| 1068 | remaining_deltas = pending_deltas.items.len; | 1068 | remaining_deltas = pending_deltas.items.len; |
| 1069 | } | 1069 | } |
| 1070 | 1070 | ||
| 1071 | var oids = std.ArrayListUnmanaged(Oid){}; | 1071 | var oids: std.ArrayListUnmanaged(Oid) = .empty; |
| 1072 | defer oids.deinit(allocator); | 1072 | defer oids.deinit(allocator); |
| 1073 | try oids.ensureTotalCapacityPrecise(allocator, index_entries.count()); | 1073 | try oids.ensureTotalCapacityPrecise(allocator, index_entries.count()); |
| 1074 | var index_entries_iter = index_entries.iterator(); | 1074 | var index_entries_iter = index_entries.iterator(); |
| ... | @@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) | ... | @@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) |
| 1109 | try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big); | 1109 | try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big); |
| 1110 | } | 1110 | } |
| 1111 | 1111 | ||
| 1112 | var big_offsets = std.ArrayListUnmanaged(u64){}; | 1112 | var big_offsets: std.ArrayListUnmanaged(u64) = .empty; |
| 1113 | defer big_offsets.deinit(allocator); | 1113 | defer big_offsets.deinit(allocator); |
| 1114 | for (oids.items) |oid| { | 1114 | for (oids.items) |oid| { |
| 1115 | const offset = index_entries.get(oid).?.offset; | 1115 | const offset = index_entries.get(oid).?.offset; |
| ... | @@ -1213,7 +1213,7 @@ fn indexPackHashDelta( | ... | @@ -1213,7 +1213,7 @@ fn indexPackHashDelta( |
| 1213 | // Figure out the chain of deltas to resolve | 1213 | // Figure out the chain of deltas to resolve |
| 1214 | var base_offset = delta.offset; | 1214 | var base_offset = delta.offset; |
| 1215 | var base_header: EntryHeader = undefined; | 1215 | var base_header: EntryHeader = undefined; |
| 1216 | var delta_offsets = std.ArrayListUnmanaged(u64){}; | 1216 | var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; |
| 1217 | defer delta_offsets.deinit(allocator); | 1217 | defer delta_offsets.deinit(allocator); |
| 1218 | const base_object = while (true) { | 1218 | const base_object = while (true) { |
| 1219 | if (cache.get(base_offset)) |base_object| break base_object; | 1219 | if (cache.get(base_offset)) |base_object| break base_object; |
| ... | @@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" { | ... | @@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" { |
| 1447 | "file8", | 1447 | "file8", |
| 1448 | "file9", | 1448 | "file9", |
| 1449 | }; | 1449 | }; |
| 1450 | var actual_files: std.ArrayListUnmanaged([]u8) = .{}; | 1450 | var actual_files: std.ArrayListUnmanaged([]u8) = .empty; |
| 1451 | defer actual_files.deinit(testing.allocator); | 1451 | defer actual_files.deinit(testing.allocator); |
| 1452 | defer for (actual_files.items) |file| testing.allocator.free(file); | 1452 | defer for (actual_files.items) |file| testing.allocator.free(file); |
| 1453 | var walker = try worktree.dir.walk(testing.allocator); | 1453 | var walker = try worktree.dir.walk(testing.allocator); |
src/Sema.zig+21-21| ... | @@ -13,7 +13,7 @@ gpa: Allocator, | ... | @@ -13,7 +13,7 @@ gpa: Allocator, |
| 13 | arena: Allocator, | 13 | arena: Allocator, |
| 14 | code: Zir, | 14 | code: Zir, |
| 15 | air_instructions: std.MultiArrayList(Air.Inst) = .{}, | 15 | air_instructions: std.MultiArrayList(Air.Inst) = .{}, |
| 16 | air_extra: std.ArrayListUnmanaged(u32) = .{}, | 16 | air_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 17 | /// Maps ZIR to AIR. | 17 | /// Maps ZIR to AIR. |
| 18 | inst_map: InstMap = .{}, | 18 | inst_map: InstMap = .{}, |
| 19 | /// The "owner" of a `Sema` represents the root "thing" that is being analyzed. | 19 | /// The "owner" of a `Sema` represents the root "thing" that is being analyzed. |
| ... | @@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded, | ... | @@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded, |
| 65 | /// They are created when an break_inline passes through a runtime condition, because | 65 | /// They are created when an break_inline passes through a runtime condition, because |
| 66 | /// Sema must convert comptime control flow to runtime control flow, which means | 66 | /// Sema must convert comptime control flow to runtime control flow, which means |
| 67 | /// breaking from a block. | 67 | /// breaking from a block. |
| 68 | post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .{}, | 68 | post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .empty, |
| 69 | /// Populated with the last compile error created. | 69 | /// Populated with the last compile error created. |
| 70 | err: ?*Zcu.ErrorMsg = null, | 70 | err: ?*Zcu.ErrorMsg = null, |
| 71 | /// Set to true when analyzing a func type instruction so that nested generic | 71 | /// Set to true when analyzing a func type instruction so that nested generic |
| ... | @@ -74,12 +74,12 @@ no_partial_func_ty: bool = false, | ... | @@ -74,12 +74,12 @@ no_partial_func_ty: bool = false, |
| 74 | 74 | ||
| 75 | /// The temporary arena is used for the memory of the `InferredAlloc` values | 75 | /// The temporary arena is used for the memory of the `InferredAlloc` values |
| 76 | /// here so the values can be dropped without any cleanup. | 76 | /// here so the values can be dropped without any cleanup. |
| 77 | unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .{}, | 77 | unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty, |
| 78 | 78 | ||
| 79 | /// Links every pointer derived from a base `alloc` back to that `alloc`. Used | 79 | /// Links every pointer derived from a base `alloc` back to that `alloc`. Used |
| 80 | /// to detect comptime-known `const`s. | 80 | /// to detect comptime-known `const`s. |
| 81 | /// TODO: ZIR liveness analysis would allow us to remove elements from this map. | 81 | /// TODO: ZIR liveness analysis would allow us to remove elements from this map. |
| 82 | base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, | 82 | base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .empty, |
| 83 | 83 | ||
| 84 | /// Runtime `alloc`s are placed in this map to track all comptime-known writes | 84 | /// Runtime `alloc`s are placed in this map to track all comptime-known writes |
| 85 | /// before the corresponding `make_ptr_const` instruction. | 85 | /// before the corresponding `make_ptr_const` instruction. |
| ... | @@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, | ... | @@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, |
| 90 | /// is comptime-known, and all stores to the pointer must be applied at comptime | 90 | /// is comptime-known, and all stores to the pointer must be applied at comptime |
| 91 | /// to determine the comptime value. | 91 | /// to determine the comptime value. |
| 92 | /// Backed by gpa. | 92 | /// Backed by gpa. |
| 93 | maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .{}, | 93 | maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .empty, |
| 94 | 94 | ||
| 95 | /// Comptime-mutable allocs, and any comptime allocs which reference it, are | 95 | /// Comptime-mutable allocs, and any comptime allocs which reference it, are |
| 96 | /// stored as elements of this array. | 96 | /// stored as elements of this array. |
| 97 | /// Pointers to such memory are represented via an index into this array. | 97 | /// Pointers to such memory are represented via an index into this array. |
| 98 | /// Backed by gpa. | 98 | /// Backed by gpa. |
| 99 | comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .{}, | 99 | comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .empty, |
| 100 | 100 | ||
| 101 | /// A list of exports performed by this analysis. After this `Sema` terminates, | 101 | /// A list of exports performed by this analysis. After this `Sema` terminates, |
| 102 | /// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`. | 102 | /// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`. |
| 103 | exports: std.ArrayListUnmanaged(Zcu.Export) = .{}, | 103 | exports: std.ArrayListUnmanaged(Zcu.Export) = .empty, |
| 104 | 104 | ||
| 105 | /// All references registered so far by this `Sema`. This is a temporary duplicate | 105 | /// All references registered so far by this `Sema`. This is a temporary duplicate |
| 106 | /// of data stored in `Zcu.all_references`. It exists to avoid adding references to | 106 | /// of data stored in `Zcu.all_references`. It exists to avoid adding references to |
| 107 | /// a given `AnalUnit` multiple times. | 107 | /// a given `AnalUnit` multiple times. |
| 108 | references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, | 108 | references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, |
| 109 | type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}, | 109 | type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, |
| 110 | 110 | ||
| 111 | /// All dependencies registered so far by this `Sema`. This is a temporary duplicate | 111 | /// All dependencies registered so far by this `Sema`. This is a temporary duplicate |
| 112 | /// of the main dependency data. It exists to avoid adding dependencies to a given | 112 | /// of the main dependency data. It exists to avoid adding dependencies to a given |
| 113 | /// `AnalUnit` multiple times. | 113 | /// `AnalUnit` multiple times. |
| 114 | dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{}, | 114 | dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty, |
| 115 | 115 | ||
| 116 | /// Whether memoization of this call is permitted. Operations with side effects global | 116 | /// Whether memoization of this call is permitted. Operations with side effects global |
| 117 | /// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed | 117 | /// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed |
| ... | @@ -208,7 +208,7 @@ pub const InferredErrorSet = struct { | ... | @@ -208,7 +208,7 @@ pub const InferredErrorSet = struct { |
| 208 | /// are returned from any dependent functions. | 208 | /// are returned from any dependent functions. |
| 209 | errors: NameMap = .{}, | 209 | errors: NameMap = .{}, |
| 210 | /// Other inferred error sets which this inferred error set should include. | 210 | /// 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, |
| 212 | /// The regular error set created by resolving this inferred error set. | 212 | /// The regular error set created by resolving this inferred error set. |
| 213 | resolved: InternPool.Index = .none, | 213 | resolved: InternPool.Index = .none, |
| 214 | 214 | ||
| ... | @@ -508,9 +508,9 @@ pub const Block = struct { | ... | @@ -508,9 +508,9 @@ pub const Block = struct { |
| 508 | /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions | 508 | /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions |
| 509 | /// which correspond to `switch_continue` ZIR. The switch logic will | 509 | /// which correspond to `switch_continue` ZIR. The switch logic will |
| 510 | /// rewrite these to appropriate AIR switch dispatches. | 510 | /// rewrite these to appropriate AIR switch dispatches. |
| 511 | extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, | 511 | extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, |
| 512 | /// Same indexes, capacity, length as `extra_insts`. | 512 | /// Same indexes, capacity, length as `extra_insts`. |
| 513 | extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .{}, | 513 | extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .empty, |
| 514 | 514 | ||
| 515 | pub fn deinit(merges: *@This(), allocator: Allocator) void { | 515 | pub fn deinit(merges: *@This(), allocator: Allocator) void { |
| 516 | merges.results.deinit(allocator); | 516 | merges.results.deinit(allocator); |
| ... | @@ -871,7 +871,7 @@ const InferredAlloc = struct { | ... | @@ -871,7 +871,7 @@ const InferredAlloc = struct { |
| 871 | /// is known. These should be rewritten to perform any required coercions | 871 | /// is known. These should be rewritten to perform any required coercions |
| 872 | /// when the type is resolved. | 872 | /// when the type is resolved. |
| 873 | /// Allocated from `sema.arena`. | 873 | /// Allocated from `sema.arena`. |
| 874 | prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, | 874 | prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, |
| 875 | }; | 875 | }; |
| 876 | 876 | ||
| 877 | const NeededComptimeReason = struct { | 877 | const NeededComptimeReason = struct { |
| ... | @@ -2908,7 +2908,7 @@ fn createTypeName( | ... | @@ -2908,7 +2908,7 @@ fn createTypeName( |
| 2908 | const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail); | 2908 | const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail); |
| 2909 | const zir_tags = sema.code.instructions.items(.tag); | 2909 | const zir_tags = sema.code.instructions.items(.tag); |
| 2910 | 2910 | ||
| 2911 | var buf: std.ArrayListUnmanaged(u8) = .{}; | 2911 | var buf: std.ArrayListUnmanaged(u8) = .empty; |
| 2912 | defer buf.deinit(gpa); | 2912 | defer buf.deinit(gpa); |
| 2913 | 2913 | ||
| 2914 | const writer = buf.writer(gpa); | 2914 | const writer = buf.writer(gpa); |
| ... | @@ -6851,11 +6851,11 @@ fn lookupInNamespace( | ... | @@ -6851,11 +6851,11 @@ fn lookupInNamespace( |
| 6851 | 6851 | ||
| 6852 | if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) { | 6852 | if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) { |
| 6853 | const gpa = sema.gpa; | 6853 | const gpa = sema.gpa; |
| 6854 | var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{}; | 6854 | var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .empty; |
| 6855 | defer checked_namespaces.deinit(gpa); | 6855 | defer checked_namespaces.deinit(gpa); |
| 6856 | 6856 | ||
| 6857 | // Keep track of name conflicts for error notes. | 6857 | // 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; |
| 6859 | defer candidates.deinit(gpa); | 6859 | defer candidates.deinit(gpa); |
| 6860 | 6860 | ||
| 6861 | try checked_namespaces.put(gpa, namespace, {}); | 6861 | try checked_namespaces.put(gpa, namespace, {}); |
| ... | @@ -22754,7 +22754,7 @@ fn reifyUnion( | ... | @@ -22754,7 +22754,7 @@ fn reifyUnion( |
| 22754 | break :tag_ty .{ enum_tag_ty.toIntern(), true }; | 22754 | break :tag_ty .{ enum_tag_ty.toIntern(), true }; |
| 22755 | } else tag_ty: { | 22755 | } else tag_ty: { |
| 22756 | // We must track field names and set up the tag type ourselves. | 22756 | // 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; |
| 22758 | try field_names.ensureTotalCapacity(sema.arena, fields_len); | 22758 | try field_names.ensureTotalCapacity(sema.arena, fields_len); |
| 22759 | 22759 | ||
| 22760 | for (field_types, 0..) |*field_ty, field_idx| { | 22760 | for (field_types, 0..) |*field_ty, field_idx| { |
| ... | @@ -37075,7 +37075,7 @@ fn unionFields( | ... | @@ -37075,7 +37075,7 @@ fn unionFields( |
| 37075 | 37075 | ||
| 37076 | var int_tag_ty: Type = undefined; | 37076 | var int_tag_ty: Type = undefined; |
| 37077 | var enum_field_names: []InternPool.NullTerminatedString = &.{}; | 37077 | 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; |
| 37079 | var explicit_tags_seen: []bool = &.{}; | 37079 | var explicit_tags_seen: []bool = &.{}; |
| 37080 | if (tag_type_ref != .none) { | 37080 | if (tag_type_ref != .none) { |
| 37081 | const tag_ty_src: LazySrcLoc = .{ | 37081 | const tag_ty_src: LazySrcLoc = .{ |
| ... | @@ -37126,8 +37126,8 @@ fn unionFields( | ... | @@ -37126,8 +37126,8 @@ fn unionFields( |
| 37126 | enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len); | 37126 | enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len); |
| 37127 | } | 37127 | } |
| 37128 | 37128 | ||
| 37129 | var field_types: std.ArrayListUnmanaged(InternPool.Index) = .{}; | 37129 | var field_types: std.ArrayListUnmanaged(InternPool.Index) = .empty; |
| 37130 | var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .{}; | 37130 | var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .empty; |
| 37131 | 37131 | ||
| 37132 | try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len); | 37132 | try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len); |
| 37133 | if (small.any_aligned_fields) | 37133 | if (small.any_aligned_fields) |
src/Zcu.zig+45-45| ... | @@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory, | ... | @@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory, |
| 76 | 76 | ||
| 77 | /// This is where all `Export` values are stored. Not all values here are necessarily valid exports; | 77 | /// This is where all `Export` values are stored. Not all values here are necessarily valid exports; |
| 78 | /// to enumerate all exports, `single_exports` and `multi_exports` must be consulted. | 78 | /// to enumerate all exports, `single_exports` and `multi_exports` must be consulted. |
| 79 | all_exports: std.ArrayListUnmanaged(Export) = .{}, | 79 | all_exports: std.ArrayListUnmanaged(Export) = .empty, |
| 80 | /// This is a list of free indices in `all_exports`. These indices may be reused by exports from | 80 | /// This is a list of free indices in `all_exports`. These indices may be reused by exports from |
| 81 | /// future semantic analysis. | 81 | /// future semantic analysis. |
| 82 | free_exports: std.ArrayListUnmanaged(u32) = .{}, | 82 | free_exports: std.ArrayListUnmanaged(u32) = .empty, |
| 83 | /// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of | 83 | /// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of |
| 84 | /// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit` | 84 | /// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit` |
| 85 | /// whose analysis triggered the export. | 85 | /// whose analysis triggered the export. |
| 86 | single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, | 86 | single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, |
| 87 | /// Like `single_exports`, but for `AnalUnit`s which perform multiple exports. | 87 | /// Like `single_exports`, but for `AnalUnit`s which perform multiple exports. |
| 88 | /// The exports are `all_exports.items[index..][0..len]`. | 88 | /// The exports are `all_exports.items[index..][0..len]`. |
| 89 | multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { | 89 | multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { |
| ... | @@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { | ... | @@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { |
| 104 | /// `Compilation.update` of the process for a given `Compilation`. | 104 | /// `Compilation.update` of the process for a given `Compilation`. |
| 105 | /// | 105 | /// |
| 106 | /// Indexes correspond 1:1 to `files`. | 106 | /// Indexes correspond 1:1 to `files`. |
| 107 | import_table: std.StringArrayHashMapUnmanaged(File.Index) = .{}, | 107 | import_table: std.StringArrayHashMapUnmanaged(File.Index) = .empty, |
| 108 | 108 | ||
| 109 | /// The set of all the files which have been loaded with `@embedFile` in the Module. | 109 | /// The set of all the files which have been loaded with `@embedFile` in the Module. |
| 110 | /// We keep track of this in order to iterate over it and check which files have been | 110 | /// We keep track of this in order to iterate over it and check which files have been |
| 111 | /// modified on the file system when an update is requested, as well as to cache | 111 | /// modified on the file system when an update is requested, as well as to cache |
| 112 | /// `@embedFile` results. | 112 | /// `@embedFile` results. |
| 113 | /// Keys are fully resolved file paths. This table owns the keys and values. | 113 | /// Keys are fully resolved file paths. This table owns the keys and values. |
| 114 | embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .{}, | 114 | embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .empty, |
| 115 | 115 | ||
| 116 | /// Stores all Type and Value objects. | 116 | /// Stores all Type and Value objects. |
| 117 | /// The idea is that this will be periodically garbage-collected, but such logic | 117 | /// The idea is that this will be periodically garbage-collected, but such logic |
| 118 | /// is not yet implemented. | 118 | /// is not yet implemented. |
| 119 | intern_pool: InternPool = .{}, | 119 | intern_pool: InternPool = .empty, |
| 120 | 120 | ||
| 121 | analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, | 121 | analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, |
| 122 | /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. | 122 | /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. |
| 123 | failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .{}, | 123 | failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty, |
| 124 | /// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed. | 124 | /// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed. |
| 125 | transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, | 125 | transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, |
| 126 | /// This `Nav` succeeded analysis, but failed codegen. | 126 | /// This `Nav` succeeded analysis, but failed codegen. |
| 127 | /// This may be a simple "value" `Nav`, or it may be a function. | 127 | /// This may be a simple "value" `Nav`, or it may be a function. |
| 128 | /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. | 128 | /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. |
| 129 | failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .{}, | 129 | failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty, |
| 130 | /// Keep track of one `@compileLog` callsite per `AnalUnit`. | 130 | /// Keep track of one `@compileLog` callsite per `AnalUnit`. |
| 131 | /// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`. | 131 | /// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`. |
| 132 | compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { | 132 | compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { |
| ... | @@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { | ... | @@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { |
| 141 | }) = .{}, | 141 | }) = .{}, |
| 142 | /// Using a map here for consistency with the other fields here. | 142 | /// Using a map here for consistency with the other fields here. |
| 143 | /// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator. | 143 | /// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator. |
| 144 | failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .{}, | 144 | failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .empty, |
| 145 | /// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator. | 145 | /// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator. |
| 146 | failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .{}, | 146 | failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .empty, |
| 147 | /// Key is index into `all_exports`. | 147 | /// Key is index into `all_exports`. |
| 148 | failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .{}, | 148 | failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .empty, |
| 149 | /// If analysis failed due to a cimport error, the corresponding Clang errors | 149 | /// If analysis failed due to a cimport error, the corresponding Clang errors |
| 150 | /// are stored here. | 150 | /// are stored here. |
| 151 | cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .{}, | 151 | cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty, |
| 152 | 152 | ||
| 153 | /// Maximum amount of distinct error values, set by --error-limit | 153 | /// Maximum amount of distinct error values, set by --error-limit |
| 154 | error_limit: ErrorInt, | 154 | error_limit: ErrorInt, |
| ... | @@ -156,19 +156,19 @@ error_limit: ErrorInt, | ... | @@ -156,19 +156,19 @@ error_limit: ErrorInt, |
| 156 | /// Value is the number of PO dependencies of this AnalUnit. | 156 | /// Value is the number of PO dependencies of this AnalUnit. |
| 157 | /// This value will decrease as we perform semantic analysis to learn what is outdated. | 157 | /// This value will decrease as we perform semantic analysis to learn what is outdated. |
| 158 | /// If any of these PO deps is outdated, this value will be moved to `outdated`. | 158 | /// If any of these PO deps is outdated, this value will be moved to `outdated`. |
| 159 | potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, | 159 | potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, |
| 160 | /// Value is the number of PO dependencies of this AnalUnit. | 160 | /// Value is the number of PO dependencies of this AnalUnit. |
| 161 | /// Once this value drops to 0, the AnalUnit is a candidate for re-analysis. | 161 | /// Once this value drops to 0, the AnalUnit is a candidate for re-analysis. |
| 162 | outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, | 162 | outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, |
| 163 | /// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0. | 163 | /// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0. |
| 164 | /// Such `AnalUnit`s are ready for immediate re-analysis. | 164 | /// Such `AnalUnit`s are ready for immediate re-analysis. |
| 165 | /// See `findOutdatedToAnalyze` for details. | 165 | /// See `findOutdatedToAnalyze` for details. |
| 166 | outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, | 166 | outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, |
| 167 | /// This contains a list of AnalUnit whose analysis or codegen failed, but the | 167 | /// This contains a list of AnalUnit whose analysis or codegen failed, but the |
| 168 | /// failure was something like running out of disk space, and trying again may | 168 | /// failure was something like running out of disk space, and trying again may |
| 169 | /// succeed. On the next update, we will flush this list, marking all members of | 169 | /// succeed. On the next update, we will flush this list, marking all members of |
| 170 | /// it as outdated. | 170 | /// it as outdated. |
| 171 | retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .{}, | 171 | retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .empty, |
| 172 | 172 | ||
| 173 | /// These are the modules which we initially queue for analysis in `Compilation.update`. | 173 | /// These are the modules which we initially queue for analysis in `Compilation.update`. |
| 174 | /// `resolveReferences` will use these as the root of its reachability traversal. | 174 | /// `resolveReferences` will use these as the root of its reachability traversal. |
| ... | @@ -184,31 +184,31 @@ stage1_flags: packed struct { | ... | @@ -184,31 +184,31 @@ stage1_flags: packed struct { |
| 184 | reserved: u2 = 0, | 184 | reserved: u2 = 0, |
| 185 | } = .{}, | 185 | } = .{}, |
| 186 | 186 | ||
| 187 | compile_log_text: std.ArrayListUnmanaged(u8) = .{}, | 187 | compile_log_text: std.ArrayListUnmanaged(u8) = .empty, |
| 188 | 188 | ||
| 189 | test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .{}, | 189 | test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, |
| 190 | 190 | ||
| 191 | global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .{}, | 191 | global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .empty, |
| 192 | 192 | ||
| 193 | /// Key is the `AnalUnit` *performing* the reference. This representation allows | 193 | /// Key is the `AnalUnit` *performing* the reference. This representation allows |
| 194 | /// incremental updates to quickly delete references caused by a specific `AnalUnit`. | 194 | /// incremental updates to quickly delete references caused by a specific `AnalUnit`. |
| 195 | /// Value is index into `all_references` of the first reference triggered by the unit. | 195 | /// Value is index into `all_references` of the first reference triggered by the unit. |
| 196 | /// The `next` field on the `Reference` forms a linked list of all references | 196 | /// The `next` field on the `Reference` forms a linked list of all references |
| 197 | /// triggered by the key `AnalUnit`. | 197 | /// triggered by the key `AnalUnit`. |
| 198 | reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, | 198 | reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, |
| 199 | all_references: std.ArrayListUnmanaged(Reference) = .{}, | 199 | all_references: std.ArrayListUnmanaged(Reference) = .empty, |
| 200 | /// Freelist of indices in `all_references`. | 200 | /// Freelist of indices in `all_references`. |
| 201 | free_references: std.ArrayListUnmanaged(u32) = .{}, | 201 | free_references: std.ArrayListUnmanaged(u32) = .empty, |
| 202 | 202 | ||
| 203 | /// Key is the `AnalUnit` *performing* the reference. This representation allows | 203 | /// Key is the `AnalUnit` *performing* the reference. This representation allows |
| 204 | /// incremental updates to quickly delete references caused by a specific `AnalUnit`. | 204 | /// incremental updates to quickly delete references caused by a specific `AnalUnit`. |
| 205 | /// Value is index into `all_type_reference` of the first reference triggered by the unit. | 205 | /// Value is index into `all_type_reference` of the first reference triggered by the unit. |
| 206 | /// The `next` field on the `TypeReference` forms a linked list of all type references | 206 | /// The `next` field on the `TypeReference` forms a linked list of all type references |
| 207 | /// triggered by the key `AnalUnit`. | 207 | /// triggered by the key `AnalUnit`. |
| 208 | type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, | 208 | type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, |
| 209 | all_type_references: std.ArrayListUnmanaged(TypeReference) = .{}, | 209 | all_type_references: std.ArrayListUnmanaged(TypeReference) = .empty, |
| 210 | /// Freelist of indices in `all_type_references`. | 210 | /// Freelist of indices in `all_type_references`. |
| 211 | free_type_references: std.ArrayListUnmanaged(u32) = .{}, | 211 | free_type_references: std.ArrayListUnmanaged(u32) = .empty, |
| 212 | 212 | ||
| 213 | panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len, | 213 | panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len, |
| 214 | /// The panic function body. | 214 | /// The panic function body. |
| ... | @@ -338,16 +338,16 @@ pub const Namespace = struct { | ... | @@ -338,16 +338,16 @@ pub const Namespace = struct { |
| 338 | /// Will be a struct, enum, union, or opaque. | 338 | /// Will be a struct, enum, union, or opaque. |
| 339 | owner_type: InternPool.Index, | 339 | owner_type: InternPool.Index, |
| 340 | /// Members of the namespace which are marked `pub`. | 340 | /// 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, |
| 342 | /// Members of the namespace which are *not* marked `pub`. | 342 | /// 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, |
| 344 | /// All `usingnamespace` declarations in this namespace which are marked `pub`. | 344 | /// 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, |
| 346 | /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`. | 346 | /// 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, |
| 348 | /// All `comptime` and `test` declarations in this namespace. We store these purely so that | 348 | /// All `comptime` and `test` declarations in this namespace. We store these purely so that |
| 349 | /// incremental compilation can re-use the existing `Cau`s when a namespace changes. | 349 | /// 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, |
| 351 | 351 | ||
| 352 | pub const Index = InternPool.NamespaceIndex; | 352 | pub const Index = InternPool.NamespaceIndex; |
| 353 | pub const OptionalIndex = InternPool.OptionalNamespaceIndex; | 353 | pub const OptionalIndex = InternPool.OptionalNamespaceIndex; |
| ... | @@ -451,7 +451,7 @@ pub const File = struct { | ... | @@ -451,7 +451,7 @@ pub const File = struct { |
| 451 | /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen. | 451 | /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen. |
| 452 | multi_pkg: bool = false, | 452 | multi_pkg: bool = false, |
| 453 | /// List of references to this file, used for multi-package errors. | 453 | /// List of references to this file, used for multi-package errors. |
| 454 | references: std.ArrayListUnmanaged(File.Reference) = .{}, | 454 | references: std.ArrayListUnmanaged(File.Reference) = .empty, |
| 455 | 455 | ||
| 456 | /// The most recent successful ZIR for this file, with no errors. | 456 | /// The most recent successful ZIR for this file, with no errors. |
| 457 | /// This is only populated when a previously successful ZIR | 457 | /// This is only populated when a previously successful ZIR |
| ... | @@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew( | ... | @@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew( |
| 2551 | old_inst: Zir.Inst.Index, | 2551 | old_inst: Zir.Inst.Index, |
| 2552 | new_inst: Zir.Inst.Index, | 2552 | new_inst: Zir.Inst.Index, |
| 2553 | }; | 2553 | }; |
| 2554 | var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .{}; | 2554 | var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .empty; |
| 2555 | defer match_stack.deinit(gpa); | 2555 | defer match_stack.deinit(gpa); |
| 2556 | 2556 | ||
| 2557 | // Used as temporary buffers for namespace declaration instructions | 2557 | // 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; |
| 2559 | defer old_decls.deinit(gpa); | 2559 | defer old_decls.deinit(gpa); |
| 2560 | var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; | 2560 | var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; |
| 2561 | defer new_decls.deinit(gpa); | 2561 | defer new_decls.deinit(gpa); |
| 2562 | 2562 | ||
| 2563 | // Map the main struct inst (and anything in its fields) | 2563 | // Map the main struct inst (and anything in its fields) |
| ... | @@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew( | ... | @@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew( |
| 2582 | try inst_map.put(gpa, match_item.old_inst, match_item.new_inst); | 2582 | try inst_map.put(gpa, match_item.old_inst, match_item.new_inst); |
| 2583 | 2583 | ||
| 2584 | // Maps decl name to `declaration` instruction. | 2584 | // 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; |
| 2586 | defer named_decls.deinit(gpa); | 2586 | defer named_decls.deinit(gpa); |
| 2587 | // Maps test name to `declaration` instruction. | 2587 | // 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; |
| 2589 | defer named_tests.deinit(gpa); | 2589 | defer named_tests.deinit(gpa); |
| 2590 | // All unnamed tests, in order, for a best-effort match. | 2590 | // 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; |
| 2592 | defer unnamed_tests.deinit(gpa); | 2592 | defer unnamed_tests.deinit(gpa); |
| 2593 | // All comptime declarations, in order, for a best-effort match. | 2593 | // 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; |
| 2595 | defer comptime_decls.deinit(gpa); | 2595 | defer comptime_decls.deinit(gpa); |
| 2596 | // All usingnamespace declarations, in order, for a best-effort match. | 2596 | // 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; |
| 2598 | defer usingnamespace_decls.deinit(gpa); | 2598 | defer usingnamespace_decls.deinit(gpa); |
| 2599 | 2599 | ||
| 2600 | { | 2600 | { |
| ... | @@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve | ... | @@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve |
| 3154 | const comp = zcu.comp; | 3154 | const comp = zcu.comp; |
| 3155 | const ip = &zcu.intern_pool; | 3155 | const ip = &zcu.intern_pool; |
| 3156 | 3156 | ||
| 3157 | var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; | 3157 | var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; |
| 3158 | errdefer result.deinit(gpa); | 3158 | errdefer result.deinit(gpa); |
| 3159 | 3159 | ||
| 3160 | var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}; | 3160 | var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; |
| 3161 | var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .{}; | 3161 | var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty; |
| 3162 | var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; | 3162 | var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; |
| 3163 | defer { | 3163 | defer { |
| 3164 | checked_types.deinit(gpa); | 3164 | checked_types.deinit(gpa); |
| 3165 | type_queue.deinit(gpa); | 3165 | type_queue.deinit(gpa); |
src/Zcu/PerThread.zig+6-6| ... | @@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { | ... | @@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { |
| 320 | const gpa = zcu.gpa; | 320 | const gpa = zcu.gpa; |
| 321 | 321 | ||
| 322 | // We need to visit every updated File for every TrackedInst in InternPool. | 322 | // 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; |
| 324 | defer cleanupUpdatedFiles(gpa, &updated_files); | 324 | defer cleanupUpdatedFiles(gpa, &updated_files); |
| 325 | for (zcu.import_table.values()) |file_index| { | 325 | for (zcu.import_table.values()) |file_index| { |
| 326 | const file = zcu.fileByIndex(file_index); | 326 | const file = zcu.fileByIndex(file_index); |
| ... | @@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { | ... | @@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { |
| 399 | }; | 399 | }; |
| 400 | if (!has_namespace) continue; | 400 | if (!has_namespace) continue; |
| 401 | 401 | ||
| 402 | var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; | 402 | var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; |
| 403 | defer old_names.deinit(zcu.gpa); | 403 | defer old_names.deinit(zcu.gpa); |
| 404 | { | 404 | { |
| 405 | var it = old_zir.declIterator(old_inst); | 405 | var it = old_zir.declIterator(old_inst); |
| ... | @@ -1721,7 +1721,7 @@ pub fn scanNamespace( | ... | @@ -1721,7 +1721,7 @@ pub fn scanNamespace( |
| 1721 | // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather | 1721 | // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather |
| 1722 | // than their name. We'll build an efficient mapping now, then discard the current `decls`. | 1722 | // than their name. We'll build an efficient mapping now, then discard the current `decls`. |
| 1723 | // We map to the `Cau`, since not every declaration has a `Nav`. | 1723 | // 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; |
| 1725 | defer existing_by_inst.deinit(gpa); | 1725 | defer existing_by_inst.deinit(gpa); |
| 1726 | 1726 | ||
| 1727 | try existing_by_inst.ensureTotalCapacity(gpa, @intCast( | 1727 | try existing_by_inst.ensureTotalCapacity(gpa, @intCast( |
| ... | @@ -1761,7 +1761,7 @@ pub fn scanNamespace( | ... | @@ -1761,7 +1761,7 @@ pub fn scanNamespace( |
| 1761 | } | 1761 | } |
| 1762 | } | 1762 | } |
| 1763 | 1763 | ||
| 1764 | var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; | 1764 | var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; |
| 1765 | defer seen_decls.deinit(gpa); | 1765 | defer seen_decls.deinit(gpa); |
| 1766 | 1766 | ||
| 1767 | namespace.pub_decls.clearRetainingCapacity(); | 1767 | namespace.pub_decls.clearRetainingCapacity(); |
| ... | @@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void { | ... | @@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void { |
| 2293 | const gpa = zcu.gpa; | 2293 | const gpa = zcu.gpa; |
| 2294 | 2294 | ||
| 2295 | // First, construct a mapping of every exported value and Nav to the indices of all its different exports. | 2295 | // 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)) = .{}; | 2296 | var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .empty; |
| 2297 | var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .{}; | 2297 | var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .empty; |
| 2298 | defer { | 2298 | defer { |
| 2299 | for (nav_exports.values()) |*exports| { | 2299 | for (nav_exports.values()) |*exports| { |
| 2300 | exports.deinit(gpa); | 2300 | exports.deinit(gpa); |
src/arch/aarch64/CodeGen.zig+6-6| ... | @@ -62,7 +62,7 @@ stack_align: u32, | ... | @@ -62,7 +62,7 @@ stack_align: u32, |
| 62 | /// MIR Instructions | 62 | /// MIR Instructions |
| 63 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 63 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, |
| 64 | /// MIR extra data | 64 | /// MIR extra data |
| 65 | mir_extra: std.ArrayListUnmanaged(u32) = .{}, | 65 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 66 | 66 | ||
| 67 | /// Byte offset within the source file of the ending curly. | 67 | /// Byte offset within the source file of the ending curly. |
| 68 | end_di_line: u32, | 68 | end_di_line: u32, |
| ... | @@ -71,13 +71,13 @@ end_di_column: u32, | ... | @@ -71,13 +71,13 @@ end_di_column: u32, |
| 71 | /// The value is an offset into the `Function` `code` from the beginning. | 71 | /// The value is an offset into the `Function` `code` from the beginning. |
| 72 | /// To perform the reloc, write 32-bit signed little-endian integer | 72 | /// To perform the reloc, write 32-bit signed little-endian integer |
| 73 | /// which is a relative jump, based on the address following the reloc. | 73 | /// which is a relative jump, based on the address following the reloc. |
| 74 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, | 74 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, |
| 75 | 75 | ||
| 76 | /// We postpone the creation of debug info for function args and locals | 76 | /// We postpone the creation of debug info for function args and locals |
| 77 | /// until after all Mir instructions have been generated. Only then we | 77 | /// until after all Mir instructions have been generated. Only then we |
| 78 | /// will know saved_regs_stack_space which is necessary in order to | 78 | /// will know saved_regs_stack_space which is necessary in order to |
| 79 | /// calculate the right stack offsest with respect to the `.fp` register. | 79 | /// calculate the right stack offsest with respect to the `.fp` register. |
| 80 | dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, | 80 | dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, |
| 81 | 81 | ||
| 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, | 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, |
| 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" | 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" |
| ... | @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, | ... | @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, |
| 89 | branch_stack: *std.ArrayList(Branch), | 89 | branch_stack: *std.ArrayList(Branch), |
| 90 | 90 | ||
| 91 | // Key is the block instruction | 91 | // Key is the block instruction |
| 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 93 | 93 | ||
| 94 | register_manager: RegisterManager = .{}, | 94 | register_manager: RegisterManager = .{}, |
| 95 | /// Maps offset to what is stored there. | 95 | /// Maps offset to what is stored there. |
| 96 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, | 96 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, |
| 97 | /// Tracks the current instruction allocated to the compare flags | 97 | /// Tracks the current instruction allocated to the compare flags |
| 98 | compare_flags_inst: ?Air.Inst.Index = null, | 98 | compare_flags_inst: ?Air.Inst.Index = null, |
| 99 | 99 | ||
| ... | @@ -247,7 +247,7 @@ const DbgInfoReloc = struct { | ... | @@ -247,7 +247,7 @@ const DbgInfoReloc = struct { |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| 249 | const Branch = struct { | 249 | const Branch = struct { |
| 250 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, | 250 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, |
| 251 | 251 | ||
| 252 | fn deinit(self: *Branch, gpa: Allocator) void { | 252 | fn deinit(self: *Branch, gpa: Allocator) void { |
| 253 | self.inst_table.deinit(gpa); | 253 | self.inst_table.deinit(gpa); |
src/arch/aarch64/Emit.zig+4-4| ... | @@ -33,18 +33,18 @@ prev_di_pc: usize, | ... | @@ -33,18 +33,18 @@ prev_di_pc: usize, |
| 33 | saved_regs_stack_space: u32, | 33 | saved_regs_stack_space: u32, |
| 34 | 34 | ||
| 35 | /// The branch type of every branch | 35 | /// The branch type of every branch |
| 36 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, | 36 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, |
| 37 | 37 | ||
| 38 | /// For every forward branch, maps the target instruction to a list of | 38 | /// For every forward branch, maps the target instruction to a list of |
| 39 | /// branches which branch to this target instruction | 39 | /// branches which branch to this target instruction |
| 40 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, | 40 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, |
| 41 | 41 | ||
| 42 | /// For backward branches: stores the code offset of the target | 42 | /// For backward branches: stores the code offset of the target |
| 43 | /// instruction | 43 | /// instruction |
| 44 | /// | 44 | /// |
| 45 | /// For forward branches: stores the code offset of the branch | 45 | /// For forward branches: stores the code offset of the branch |
| 46 | /// instruction | 46 | /// instruction |
| 47 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, | 47 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, |
| 48 | 48 | ||
| 49 | /// The final stack frame size of the function (already aligned to the | 49 | /// The final stack frame size of the function (already aligned to the |
| 50 | /// respective stack alignment). Does not include prologue stack space. | 50 | /// respective stack alignment). Does not include prologue stack space. |
| ... | @@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void { | ... | @@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void { |
| 346 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { | 346 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { |
| 347 | try origin_list.append(gpa, inst); | 347 | try origin_list.append(gpa, inst); |
| 348 | } else { | 348 | } else { |
| 349 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; | 349 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; |
| 350 | try origin_list.append(gpa, inst); | 350 | try origin_list.append(gpa, inst); |
| 351 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); | 351 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); |
| 352 | } | 352 | } |
src/arch/arm/CodeGen.zig+6-6| ... | @@ -62,7 +62,7 @@ stack_align: u32, | ... | @@ -62,7 +62,7 @@ stack_align: u32, |
| 62 | /// MIR Instructions | 62 | /// MIR Instructions |
| 63 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 63 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, |
| 64 | /// MIR extra data | 64 | /// MIR extra data |
| 65 | mir_extra: std.ArrayListUnmanaged(u32) = .{}, | 65 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 66 | 66 | ||
| 67 | /// Byte offset within the source file of the ending curly. | 67 | /// Byte offset within the source file of the ending curly. |
| 68 | end_di_line: u32, | 68 | end_di_line: u32, |
| ... | @@ -71,13 +71,13 @@ end_di_column: u32, | ... | @@ -71,13 +71,13 @@ end_di_column: u32, |
| 71 | /// The value is an offset into the `Function` `code` from the beginning. | 71 | /// The value is an offset into the `Function` `code` from the beginning. |
| 72 | /// To perform the reloc, write 32-bit signed little-endian integer | 72 | /// To perform the reloc, write 32-bit signed little-endian integer |
| 73 | /// which is a relative jump, based on the address following the reloc. | 73 | /// which is a relative jump, based on the address following the reloc. |
| 74 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, | 74 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, |
| 75 | 75 | ||
| 76 | /// We postpone the creation of debug info for function args and locals | 76 | /// We postpone the creation of debug info for function args and locals |
| 77 | /// until after all Mir instructions have been generated. Only then we | 77 | /// until after all Mir instructions have been generated. Only then we |
| 78 | /// will know saved_regs_stack_space which is necessary in order to | 78 | /// will know saved_regs_stack_space which is necessary in order to |
| 79 | /// calculate the right stack offsest with respect to the `.fp` register. | 79 | /// calculate the right stack offsest with respect to the `.fp` register. |
| 80 | dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, | 80 | dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, |
| 81 | 81 | ||
| 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, | 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, |
| 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" | 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" |
| ... | @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, | ... | @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, |
| 89 | branch_stack: *std.ArrayList(Branch), | 89 | branch_stack: *std.ArrayList(Branch), |
| 90 | 90 | ||
| 91 | // Key is the block instruction | 91 | // Key is the block instruction |
| 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 93 | 93 | ||
| 94 | register_manager: RegisterManager = .{}, | 94 | register_manager: RegisterManager = .{}, |
| 95 | /// Maps offset to what is stored there. | 95 | /// Maps offset to what is stored there. |
| 96 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, | 96 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, |
| 97 | /// Tracks the current instruction allocated to the compare flags | 97 | /// Tracks the current instruction allocated to the compare flags |
| 98 | cpsr_flags_inst: ?Air.Inst.Index = null, | 98 | cpsr_flags_inst: ?Air.Inst.Index = null, |
| 99 | 99 | ||
| ... | @@ -168,7 +168,7 @@ const MCValue = union(enum) { | ... | @@ -168,7 +168,7 @@ const MCValue = union(enum) { |
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | const Branch = struct { | 170 | const Branch = struct { |
| 171 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, | 171 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, |
| 172 | 172 | ||
| 173 | fn deinit(self: *Branch, gpa: Allocator) void { | 173 | fn deinit(self: *Branch, gpa: Allocator) void { |
| 174 | self.inst_table.deinit(gpa); | 174 | self.inst_table.deinit(gpa); |
src/arch/arm/Emit.zig+4-4| ... | @@ -40,16 +40,16 @@ saved_regs_stack_space: u32, | ... | @@ -40,16 +40,16 @@ saved_regs_stack_space: u32, |
| 40 | stack_size: u32, | 40 | stack_size: u32, |
| 41 | 41 | ||
| 42 | /// The branch type of every branch | 42 | /// The branch type of every branch |
| 43 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, | 43 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, |
| 44 | /// For every forward branch, maps the target instruction to a list of | 44 | /// For every forward branch, maps the target instruction to a list of |
| 45 | /// branches which branch to this target instruction | 45 | /// branches which branch to this target instruction |
| 46 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, | 46 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, |
| 47 | /// For backward branches: stores the code offset of the target | 47 | /// For backward branches: stores the code offset of the target |
| 48 | /// instruction | 48 | /// instruction |
| 49 | /// | 49 | /// |
| 50 | /// For forward branches: stores the code offset of the branch | 50 | /// For forward branches: stores the code offset of the branch |
| 51 | /// instruction | 51 | /// instruction |
| 52 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, | 52 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, |
| 53 | 53 | ||
| 54 | const InnerError = error{ | 54 | const InnerError = error{ |
| 55 | OutOfMemory, | 55 | OutOfMemory, |
| ... | @@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void { | ... | @@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void { |
| 264 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { | 264 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { |
| 265 | try origin_list.append(gpa, inst); | 265 | try origin_list.append(gpa, inst); |
| 266 | } else { | 266 | } else { |
| 267 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; | 267 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; |
| 268 | try origin_list.append(gpa, inst); | 268 | try origin_list.append(gpa, inst); |
| 269 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); | 269 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); |
| 270 | } | 270 | } |
src/arch/riscv64/CodeGen.zig+7-7| ... | @@ -81,7 +81,7 @@ scope_generation: u32, | ... | @@ -81,7 +81,7 @@ scope_generation: u32, |
| 81 | /// The value is an offset into the `Function` `code` from the beginning. | 81 | /// The value is an offset into the `Function` `code` from the beginning. |
| 82 | /// To perform the reloc, write 32-bit signed little-endian integer | 82 | /// To perform the reloc, write 32-bit signed little-endian integer |
| 83 | /// which is a relative jump, based on the address following the reloc. | 83 | /// which is a relative jump, based on the address following the reloc. |
| 84 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, | 84 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, |
| 85 | 85 | ||
| 86 | /// Whenever there is a runtime branch, we push a Branch onto this stack, | 86 | /// Whenever there is a runtime branch, we push a Branch onto this stack, |
| 87 | /// and pop it off when the runtime branch joins. This provides an "overlay" | 87 | /// and pop it off when the runtime branch joins. This provides an "overlay" |
| ... | @@ -97,14 +97,14 @@ avl: ?u64, | ... | @@ -97,14 +97,14 @@ avl: ?u64, |
| 97 | vtype: ?bits.VType, | 97 | vtype: ?bits.VType, |
| 98 | 98 | ||
| 99 | // Key is the block instruction | 99 | // Key is the block instruction |
| 100 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 100 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 101 | register_manager: RegisterManager = .{}, | 101 | register_manager: RegisterManager = .{}, |
| 102 | 102 | ||
| 103 | const_tracking: ConstTrackingMap = .{}, | 103 | const_tracking: ConstTrackingMap = .{}, |
| 104 | inst_tracking: InstTrackingMap = .{}, | 104 | inst_tracking: InstTrackingMap = .{}, |
| 105 | 105 | ||
| 106 | frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, | 106 | frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, |
| 107 | free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, | 107 | free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, |
| 108 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, | 108 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, |
| 109 | 109 | ||
| 110 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { | 110 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { |
| ... | @@ -342,7 +342,7 @@ const MCValue = union(enum) { | ... | @@ -342,7 +342,7 @@ const MCValue = union(enum) { |
| 342 | }; | 342 | }; |
| 343 | 343 | ||
| 344 | const Branch = struct { | 344 | const Branch = struct { |
| 345 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, | 345 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, |
| 346 | 346 | ||
| 347 | fn deinit(func: *Branch, gpa: Allocator) void { | 347 | fn deinit(func: *Branch, gpa: Allocator) void { |
| 348 | func.inst_table.deinit(gpa); | 348 | func.inst_table.deinit(gpa); |
| ... | @@ -621,7 +621,7 @@ const FrameAlloc = struct { | ... | @@ -621,7 +621,7 @@ const FrameAlloc = struct { |
| 621 | }; | 621 | }; |
| 622 | 622 | ||
| 623 | const BlockData = struct { | 623 | const BlockData = struct { |
| 624 | relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, | 624 | relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 625 | state: State, | 625 | state: State, |
| 626 | 626 | ||
| 627 | fn deinit(bd: *BlockData, gpa: Allocator) void { | 627 | fn deinit(bd: *BlockData, gpa: Allocator) void { |
| ... | @@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { |
| 6193 | 6193 | ||
| 6194 | const Label = struct { | 6194 | const Label = struct { |
| 6195 | target: Mir.Inst.Index = undefined, | 6195 | target: Mir.Inst.Index = undefined, |
| 6196 | pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, | 6196 | pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 6197 | 6197 | ||
| 6198 | const Kind = enum { definition, reference }; | 6198 | const Kind = enum { definition, reference }; |
| 6199 | 6199 | ||
| ... | @@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { |
| 6217 | return name.len > 0; | 6217 | return name.len > 0; |
| 6218 | } | 6218 | } |
| 6219 | }; | 6219 | }; |
| 6220 | var labels: std.StringHashMapUnmanaged(Label) = .{}; | 6220 | var labels: std.StringHashMapUnmanaged(Label) = .empty; |
| 6221 | defer { | 6221 | defer { |
| 6222 | var label_it = labels.valueIterator(); | 6222 | var label_it = labels.valueIterator(); |
| 6223 | while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa); | 6223 | 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, | ... | @@ -10,8 +10,8 @@ prev_di_column: u32, |
| 10 | /// Relative to the beginning of `code`. | 10 | /// Relative to the beginning of `code`. |
| 11 | prev_di_pc: usize, | 11 | prev_di_pc: usize, |
| 12 | 12 | ||
| 13 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, | 13 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, |
| 14 | relocs: std.ArrayListUnmanaged(Reloc) = .{}, | 14 | relocs: std.ArrayListUnmanaged(Reloc) = .empty, |
| 15 | 15 | ||
| 16 | pub const Error = Lower.Error || error{ | 16 | pub const Error = Lower.Error || error{ |
| 17 | EmitFail, | 17 | EmitFail, |
src/arch/sparc64/CodeGen.zig+5-5| ... | @@ -68,7 +68,7 @@ stack_align: Alignment, | ... | @@ -68,7 +68,7 @@ stack_align: Alignment, |
| 68 | /// MIR Instructions | 68 | /// MIR Instructions |
| 69 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 69 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, |
| 70 | /// MIR extra data | 70 | /// MIR extra data |
| 71 | mir_extra: std.ArrayListUnmanaged(u32) = .{}, | 71 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 72 | 72 | ||
| 73 | /// Byte offset within the source file of the ending curly. | 73 | /// Byte offset within the source file of the ending curly. |
| 74 | end_di_line: u32, | 74 | end_di_line: u32, |
| ... | @@ -77,7 +77,7 @@ end_di_column: u32, | ... | @@ -77,7 +77,7 @@ end_di_column: u32, |
| 77 | /// The value is an offset into the `Function` `code` from the beginning. | 77 | /// The value is an offset into the `Function` `code` from the beginning. |
| 78 | /// To perform the reloc, write 32-bit signed little-endian integer | 78 | /// To perform the reloc, write 32-bit signed little-endian integer |
| 79 | /// which is a relative jump, based on the address following the reloc. | 79 | /// which is a relative jump, based on the address following the reloc. |
| 80 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, | 80 | exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, |
| 81 | 81 | ||
| 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, | 82 | /// Whenever there is a runtime branch, we push a Branch onto this stack, |
| 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" | 83 | /// and pop it off when the runtime branch joins. This provides an "overlay" |
| ... | @@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, | ... | @@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, |
| 89 | branch_stack: *std.ArrayList(Branch), | 89 | branch_stack: *std.ArrayList(Branch), |
| 90 | 90 | ||
| 91 | // Key is the block instruction | 91 | // Key is the block instruction |
| 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 92 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 93 | 93 | ||
| 94 | register_manager: RegisterManager = .{}, | 94 | register_manager: RegisterManager = .{}, |
| 95 | 95 | ||
| 96 | /// Maps offset to what is stored there. | 96 | /// Maps offset to what is stored there. |
| 97 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, | 97 | stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, |
| 98 | 98 | ||
| 99 | /// Tracks the current instruction allocated to the condition flags | 99 | /// Tracks the current instruction allocated to the condition flags |
| 100 | condition_flags_inst: ?Air.Inst.Index = null, | 100 | condition_flags_inst: ?Air.Inst.Index = null, |
| ... | @@ -201,7 +201,7 @@ const MCValue = union(enum) { | ... | @@ -201,7 +201,7 @@ const MCValue = union(enum) { |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | const Branch = struct { | 203 | const Branch = struct { |
| 204 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, | 204 | inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, |
| 205 | 205 | ||
| 206 | fn deinit(self: *Branch, gpa: Allocator) void { | 206 | fn deinit(self: *Branch, gpa: Allocator) void { |
| 207 | self.inst_table.deinit(gpa); | 207 | self.inst_table.deinit(gpa); |
src/arch/sparc64/Emit.zig+4-4| ... | @@ -30,16 +30,16 @@ prev_di_column: u32, | ... | @@ -30,16 +30,16 @@ prev_di_column: u32, |
| 30 | prev_di_pc: usize, | 30 | prev_di_pc: usize, |
| 31 | 31 | ||
| 32 | /// The branch type of every branch | 32 | /// The branch type of every branch |
| 33 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, | 33 | branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, |
| 34 | /// For every forward branch, maps the target instruction to a list of | 34 | /// For every forward branch, maps the target instruction to a list of |
| 35 | /// branches which branch to this target instruction | 35 | /// branches which branch to this target instruction |
| 36 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, | 36 | branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, |
| 37 | /// For backward branches: stores the code offset of the target | 37 | /// For backward branches: stores the code offset of the target |
| 38 | /// instruction | 38 | /// instruction |
| 39 | /// | 39 | /// |
| 40 | /// For forward branches: stores the code offset of the branch | 40 | /// For forward branches: stores the code offset of the branch |
| 41 | /// instruction | 41 | /// instruction |
| 42 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, | 42 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, |
| 43 | 43 | ||
| 44 | const InnerError = error{ | 44 | const InnerError = error{ |
| 45 | OutOfMemory, | 45 | OutOfMemory, |
| ... | @@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void { | ... | @@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void { |
| 571 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { | 571 | if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { |
| 572 | try origin_list.append(gpa, inst); | 572 | try origin_list.append(gpa, inst); |
| 573 | } else { | 573 | } else { |
| 574 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; | 574 | var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; |
| 575 | try origin_list.append(gpa, inst); | 575 | try origin_list.append(gpa, inst); |
| 576 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); | 576 | try emit.branch_forward_origins.put(gpa, target_inst, origin_list); |
| 577 | } | 577 | } |
src/arch/wasm/CodeGen.zig+9-9| ... | @@ -654,7 +654,7 @@ func_index: InternPool.Index, | ... | @@ -654,7 +654,7 @@ func_index: InternPool.Index, |
| 654 | /// When we return from a branch, the branch will be popped from this list, | 654 | /// When we return from a branch, the branch will be popped from this list, |
| 655 | /// which means branches can only contain references from within its own branch, | 655 | /// which means branches can only contain references from within its own branch, |
| 656 | /// or a branch higher (lower index) in the tree. | 656 | /// or a branch higher (lower index) in the tree. |
| 657 | branches: std.ArrayListUnmanaged(Branch) = .{}, | 657 | branches: std.ArrayListUnmanaged(Branch) = .empty, |
| 658 | /// Table to save `WValue`'s generated by an `Air.Inst` | 658 | /// Table to save `WValue`'s generated by an `Air.Inst` |
| 659 | // values: ValueTable, | 659 | // values: ValueTable, |
| 660 | /// Mapping from Air.Inst.Index to block ids | 660 | /// Mapping from Air.Inst.Index to block ids |
| ... | @@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct { | ... | @@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct { |
| 663 | value: WValue, | 663 | value: WValue, |
| 664 | }) = .{}, | 664 | }) = .{}, |
| 665 | /// Maps `loop` instructions to their label. `br` to here repeats the loop. | 665 | /// Maps `loop` instructions to their label. `br` to here repeats the loop. |
| 666 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .{}, | 666 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty, |
| 667 | /// `bytes` contains the wasm bytecode belonging to the 'code' section. | 667 | /// `bytes` contains the wasm bytecode belonging to the 'code' section. |
| 668 | code: *ArrayList(u8), | 668 | code: *ArrayList(u8), |
| 669 | /// The index the next local generated will have | 669 | /// The index the next local generated will have |
| ... | @@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8), | ... | @@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8), |
| 681 | /// List of simd128 immediates. Each value is stored as an array of bytes. | 681 | /// List of simd128 immediates. Each value is stored as an array of bytes. |
| 682 | /// This list will only be populated for 128bit-simd values when the target features | 682 | /// This list will only be populated for 128bit-simd values when the target features |
| 683 | /// are enabled also. | 683 | /// are enabled also. |
| 684 | simd_immediates: std.ArrayListUnmanaged([16]u8) = .{}, | 684 | simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty, |
| 685 | /// The Target we're emitting (used to call intInfo) | 685 | /// The Target we're emitting (used to call intInfo) |
| 686 | target: *const std.Target, | 686 | target: *const std.Target, |
| 687 | /// Represents the wasm binary file that is being linked. | 687 | /// Represents the wasm binary file that is being linked. |
| ... | @@ -690,7 +690,7 @@ pt: Zcu.PerThread, | ... | @@ -690,7 +690,7 @@ pt: Zcu.PerThread, |
| 690 | /// List of MIR Instructions | 690 | /// List of MIR Instructions |
| 691 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 691 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, |
| 692 | /// Contains extra data for MIR | 692 | /// Contains extra data for MIR |
| 693 | mir_extra: std.ArrayListUnmanaged(u32) = .{}, | 693 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 694 | /// When a function is executing, we store the the current stack pointer's value within this local. | 694 | /// When a function is executing, we store the the current stack pointer's value within this local. |
| 695 | /// This value is then used to restore the stack pointer to the original value at the return of the function. | 695 | /// This value is then used to restore the stack pointer to the original value at the return of the function. |
| 696 | initial_stack_value: WValue = .none, | 696 | initial_stack_value: WValue = .none, |
| ... | @@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16", | ... | @@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16", |
| 717 | // allows us to re-use locals that are no longer used. e.g. a temporary local. | 717 | // allows us to re-use locals that are no longer used. e.g. a temporary local. |
| 718 | /// A list of indexes which represents a local of valtype `i32`. | 718 | /// A list of indexes which represents a local of valtype `i32`. |
| 719 | /// It is illegal to store a non-i32 valtype in this list. | 719 | /// It is illegal to store a non-i32 valtype in this list. |
| 720 | free_locals_i32: std.ArrayListUnmanaged(u32) = .{}, | 720 | free_locals_i32: std.ArrayListUnmanaged(u32) = .empty, |
| 721 | /// A list of indexes which represents a local of valtype `i64`. | 721 | /// A list of indexes which represents a local of valtype `i64`. |
| 722 | /// It is illegal to store a non-i64 valtype in this list. | 722 | /// It is illegal to store a non-i64 valtype in this list. |
| 723 | free_locals_i64: std.ArrayListUnmanaged(u32) = .{}, | 723 | free_locals_i64: std.ArrayListUnmanaged(u32) = .empty, |
| 724 | /// A list of indexes which represents a local of valtype `f32`. | 724 | /// A list of indexes which represents a local of valtype `f32`. |
| 725 | /// It is illegal to store a non-f32 valtype in this list. | 725 | /// It is illegal to store a non-f32 valtype in this list. |
| 726 | free_locals_f32: std.ArrayListUnmanaged(u32) = .{}, | 726 | free_locals_f32: std.ArrayListUnmanaged(u32) = .empty, |
| 727 | /// A list of indexes which represents a local of valtype `f64`. | 727 | /// A list of indexes which represents a local of valtype `f64`. |
| 728 | /// It is illegal to store a non-f64 valtype in this list. | 728 | /// It is illegal to store a non-f64 valtype in this list. |
| 729 | free_locals_f64: std.ArrayListUnmanaged(u32) = .{}, | 729 | free_locals_f64: std.ArrayListUnmanaged(u32) = .empty, |
| 730 | /// A list of indexes which represents a local of valtype `v127`. | 730 | /// A list of indexes which represents a local of valtype `v127`. |
| 731 | /// It is illegal to store a non-v128 valtype in this list. | 731 | /// It is illegal to store a non-v128 valtype in this list. |
| 732 | free_locals_v128: std.ArrayListUnmanaged(u32) = .{}, | 732 | free_locals_v128: std.ArrayListUnmanaged(u32) = .empty, |
| 733 | 733 | ||
| 734 | /// When in debug mode, this tracks if no `finishAir` was missed. | 734 | /// When in debug mode, this tracks if no `finishAir` was missed. |
| 735 | /// Forgetting to call `finishAir` will cause the result to not be | 735 | /// 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, | ... | @@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null, |
| 78 | /// MIR Instructions | 78 | /// MIR Instructions |
| 79 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, | 79 | mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, |
| 80 | /// MIR extra data | 80 | /// MIR extra data |
| 81 | mir_extra: std.ArrayListUnmanaged(u32) = .{}, | 81 | mir_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 82 | 82 | ||
| 83 | /// Byte offset within the source file of the ending curly. | 83 | /// Byte offset within the source file of the ending curly. |
| 84 | end_di_line: u32, | 84 | end_di_line: u32, |
| ... | @@ -87,13 +87,13 @@ end_di_column: u32, | ... | @@ -87,13 +87,13 @@ end_di_column: u32, |
| 87 | /// The value is an offset into the `Function` `code` from the beginning. | 87 | /// The value is an offset into the `Function` `code` from the beginning. |
| 88 | /// To perform the reloc, write 32-bit signed little-endian integer | 88 | /// To perform the reloc, write 32-bit signed little-endian integer |
| 89 | /// which is a relative jump, based on the address following the reloc. | 89 | /// which is a relative jump, based on the address following the reloc. |
| 90 | exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, | 90 | exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 91 | 91 | ||
| 92 | const_tracking: ConstTrackingMap = .{}, | 92 | const_tracking: ConstTrackingMap = .{}, |
| 93 | inst_tracking: InstTrackingMap = .{}, | 93 | inst_tracking: InstTrackingMap = .{}, |
| 94 | 94 | ||
| 95 | // Key is the block instruction | 95 | // Key is the block instruction |
| 96 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 96 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 97 | 97 | ||
| 98 | register_manager: RegisterManager = .{}, | 98 | register_manager: RegisterManager = .{}, |
| 99 | 99 | ||
| ... | @@ -101,7 +101,7 @@ register_manager: RegisterManager = .{}, | ... | @@ -101,7 +101,7 @@ register_manager: RegisterManager = .{}, |
| 101 | scope_generation: u32 = 0, | 101 | scope_generation: u32 = 0, |
| 102 | 102 | ||
| 103 | frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, | 103 | frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, |
| 104 | free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, | 104 | free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, |
| 105 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, | 105 | frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, |
| 106 | 106 | ||
| 107 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { | 107 | loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { |
| ... | @@ -799,7 +799,7 @@ const StackAllocation = struct { | ... | @@ -799,7 +799,7 @@ const StackAllocation = struct { |
| 799 | }; | 799 | }; |
| 800 | 800 | ||
| 801 | const BlockData = struct { | 801 | const BlockData = struct { |
| 802 | relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, | 802 | relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 803 | state: State, | 803 | state: State, |
| 804 | 804 | ||
| 805 | fn deinit(self: *BlockData, gpa: Allocator) void { | 805 | fn deinit(self: *BlockData, gpa: Allocator) void { |
| ... | @@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 14248 | 14248 | ||
| 14249 | const Label = struct { | 14249 | const Label = struct { |
| 14250 | target: Mir.Inst.Index = undefined, | 14250 | target: Mir.Inst.Index = undefined, |
| 14251 | pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, | 14251 | pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, |
| 14252 | 14252 | ||
| 14253 | const Kind = enum { definition, reference }; | 14253 | const Kind = enum { definition, reference }; |
| 14254 | 14254 | ||
| ... | @@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 14272 | return name.len > 0; | 14272 | return name.len > 0; |
| 14273 | } | 14273 | } |
| 14274 | }; | 14274 | }; |
| 14275 | var labels: std.StringHashMapUnmanaged(Label) = .{}; | 14275 | var labels: std.StringHashMapUnmanaged(Label) = .empty; |
| 14276 | defer { | 14276 | defer { |
| 14277 | var label_it = labels.valueIterator(); | 14277 | var label_it = labels.valueIterator(); |
| 14278 | while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa); | 14278 | 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, | ... | @@ -11,8 +11,8 @@ prev_di_column: u32, |
| 11 | /// Relative to the beginning of `code`. | 11 | /// Relative to the beginning of `code`. |
| 12 | prev_di_pc: usize, | 12 | prev_di_pc: usize, |
| 13 | 13 | ||
| 14 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, | 14 | code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, |
| 15 | relocs: std.ArrayListUnmanaged(Reloc) = .{}, | 15 | relocs: std.ArrayListUnmanaged(Reloc) = .empty, |
| 16 | 16 | ||
| 17 | pub const Error = Lower.Error || error{ | 17 | pub const Error = Lower.Error || error{ |
| 18 | EmitFail, | 18 | EmitFail, |
src/codegen/c.zig+4-4| ... | @@ -304,14 +304,14 @@ pub const Function = struct { | ... | @@ -304,14 +304,14 @@ pub const Function = struct { |
| 304 | air: Air, | 304 | air: Air, |
| 305 | liveness: Liveness, | 305 | liveness: Liveness, |
| 306 | value_map: CValueMap, | 306 | value_map: CValueMap, |
| 307 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, | 307 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, |
| 308 | next_arg_index: usize = 0, | 308 | next_arg_index: usize = 0, |
| 309 | next_block_index: usize = 0, | 309 | next_block_index: usize = 0, |
| 310 | object: Object, | 310 | object: Object, |
| 311 | lazy_fns: LazyFnMap, | 311 | lazy_fns: LazyFnMap, |
| 312 | func_index: InternPool.Index, | 312 | func_index: InternPool.Index, |
| 313 | /// All the locals, to be emitted at the top of the function. | 313 | /// All the locals, to be emitted at the top of the function. |
| 314 | locals: std.ArrayListUnmanaged(Local) = .{}, | 314 | locals: std.ArrayListUnmanaged(Local) = .empty, |
| 315 | /// Which locals are available for reuse, based on Type. | 315 | /// Which locals are available for reuse, based on Type. |
| 316 | free_locals_map: LocalsMap = .{}, | 316 | free_locals_map: LocalsMap = .{}, |
| 317 | /// Locals which will not be freed by Liveness. This is used after a | 317 | /// Locals which will not be freed by Liveness. This is used after a |
| ... | @@ -320,10 +320,10 @@ pub const Function = struct { | ... | @@ -320,10 +320,10 @@ pub const Function = struct { |
| 320 | /// of variable declarations at the top of a function, sorted descending | 320 | /// of variable declarations at the top of a function, sorted descending |
| 321 | /// by type alignment. | 321 | /// by type alignment. |
| 322 | /// The value is whether the alloc needs to be emitted in the header. | 322 | /// 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, |
| 324 | /// Maps from `loop_switch_br` instructions to the allocated local used | 324 | /// Maps from `loop_switch_br` instructions to the allocated local used |
| 325 | /// for the switch cond. Dispatches should set this local to the new cond. | 325 | /// 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, |
| 327 | 327 | ||
| 328 | fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { | 328 | fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { |
| 329 | const gop = try f.value_map.getOrPut(ref); | 329 | const gop = try f.value_map.getOrPut(ref); |
src/codegen/llvm.zig+9-9| ... | @@ -1500,7 +1500,7 @@ pub const Object = struct { | ... | @@ -1500,7 +1500,7 @@ pub const Object = struct { |
| 1500 | // instructions. Depending on the calling convention, this list is not necessarily | 1500 | // instructions. Depending on the calling convention, this list is not necessarily |
| 1501 | // a bijection with the actual LLVM parameters of the function. | 1501 | // a bijection with the actual LLVM parameters of the function. |
| 1502 | const gpa = o.gpa; | 1502 | const gpa = o.gpa; |
| 1503 | var args: std.ArrayListUnmanaged(Builder.Value) = .{}; | 1503 | var args: std.ArrayListUnmanaged(Builder.Value) = .empty; |
| 1504 | defer args.deinit(gpa); | 1504 | defer args.deinit(gpa); |
| 1505 | 1505 | ||
| 1506 | { | 1506 | { |
| ... | @@ -2497,7 +2497,7 @@ pub const Object = struct { | ... | @@ -2497,7 +2497,7 @@ pub const Object = struct { |
| 2497 | 2497 | ||
| 2498 | switch (ip.indexToKey(ty.toIntern())) { | 2498 | switch (ip.indexToKey(ty.toIntern())) { |
| 2499 | .anon_struct_type => |tuple| { | 2499 | .anon_struct_type => |tuple| { |
| 2500 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2500 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; |
| 2501 | defer fields.deinit(gpa); | 2501 | defer fields.deinit(gpa); |
| 2502 | 2502 | ||
| 2503 | try fields.ensureUnusedCapacity(gpa, tuple.types.len); | 2503 | try fields.ensureUnusedCapacity(gpa, tuple.types.len); |
| ... | @@ -2574,7 +2574,7 @@ pub const Object = struct { | ... | @@ -2574,7 +2574,7 @@ pub const Object = struct { |
| 2574 | 2574 | ||
| 2575 | const struct_type = zcu.typeToStruct(ty).?; | 2575 | const struct_type = zcu.typeToStruct(ty).?; |
| 2576 | 2576 | ||
| 2577 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2577 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; |
| 2578 | defer fields.deinit(gpa); | 2578 | defer fields.deinit(gpa); |
| 2579 | 2579 | ||
| 2580 | try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); | 2580 | try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); |
| ... | @@ -2667,7 +2667,7 @@ pub const Object = struct { | ... | @@ -2667,7 +2667,7 @@ pub const Object = struct { |
| 2667 | return debug_union_type; | 2667 | return debug_union_type; |
| 2668 | } | 2668 | } |
| 2669 | 2669 | ||
| 2670 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2670 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; |
| 2671 | defer fields.deinit(gpa); | 2671 | defer fields.deinit(gpa); |
| 2672 | 2672 | ||
| 2673 | try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); | 2673 | try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); |
| ... | @@ -3412,7 +3412,7 @@ pub const Object = struct { | ... | @@ -3412,7 +3412,7 @@ pub const Object = struct { |
| 3412 | return int_ty; | 3412 | return int_ty; |
| 3413 | } | 3413 | } |
| 3414 | 3414 | ||
| 3415 | var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){}; | 3415 | var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty; |
| 3416 | defer llvm_field_types.deinit(o.gpa); | 3416 | defer llvm_field_types.deinit(o.gpa); |
| 3417 | // Although we can estimate how much capacity to add, these cannot be | 3417 | // Although we can estimate how much capacity to add, these cannot be |
| 3418 | // relied upon because of the recursive calls to lowerType below. | 3418 | // relied upon because of the recursive calls to lowerType below. |
| ... | @@ -3481,7 +3481,7 @@ pub const Object = struct { | ... | @@ -3481,7 +3481,7 @@ pub const Object = struct { |
| 3481 | return ty; | 3481 | return ty; |
| 3482 | }, | 3482 | }, |
| 3483 | .anon_struct_type => |anon_struct_type| { | 3483 | .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; |
| 3485 | defer llvm_field_types.deinit(o.gpa); | 3485 | defer llvm_field_types.deinit(o.gpa); |
| 3486 | // Although we can estimate how much capacity to add, these cannot be | 3486 | // Although we can estimate how much capacity to add, these cannot be |
| 3487 | // relied upon because of the recursive calls to lowerType below. | 3487 | // relied upon because of the recursive calls to lowerType below. |
| ... | @@ -3672,7 +3672,7 @@ pub const Object = struct { | ... | @@ -3672,7 +3672,7 @@ pub const Object = struct { |
| 3672 | const target = zcu.getTarget(); | 3672 | const target = zcu.getTarget(); |
| 3673 | const ret_ty = try lowerFnRetTy(o, fn_info); | 3673 | const ret_ty = try lowerFnRetTy(o, fn_info); |
| 3674 | 3674 | ||
| 3675 | var llvm_params = std.ArrayListUnmanaged(Builder.Type){}; | 3675 | var llvm_params: std.ArrayListUnmanaged(Builder.Type) = .empty; |
| 3676 | defer llvm_params.deinit(o.gpa); | 3676 | defer llvm_params.deinit(o.gpa); |
| 3677 | 3677 | ||
| 3678 | if (firstParamSRet(fn_info, zcu, target)) { | 3678 | if (firstParamSRet(fn_info, zcu, target)) { |
| ... | @@ -7438,7 +7438,7 @@ pub const FuncGen = struct { | ... | @@ -7438,7 +7438,7 @@ pub const FuncGen = struct { |
| 7438 | const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]); | 7438 | const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]); |
| 7439 | extra_i += inputs.len; | 7439 | extra_i += inputs.len; |
| 7440 | 7440 | ||
| 7441 | var llvm_constraints: std.ArrayListUnmanaged(u8) = .{}; | 7441 | var llvm_constraints: std.ArrayListUnmanaged(u8) = .empty; |
| 7442 | defer llvm_constraints.deinit(self.gpa); | 7442 | defer llvm_constraints.deinit(self.gpa); |
| 7443 | 7443 | ||
| 7444 | var arena_allocator = std.heap.ArenaAllocator.init(self.gpa); | 7444 | var arena_allocator = std.heap.ArenaAllocator.init(self.gpa); |
| ... | @@ -7466,7 +7466,7 @@ pub const FuncGen = struct { | ... | @@ -7466,7 +7466,7 @@ pub const FuncGen = struct { |
| 7466 | var llvm_param_i: usize = 0; | 7466 | var llvm_param_i: usize = 0; |
| 7467 | var total_i: u16 = 0; | 7467 | var total_i: u16 = 0; |
| 7468 | 7468 | ||
| 7469 | var name_map: std.StringArrayHashMapUnmanaged(u16) = .{}; | 7469 | var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty; |
| 7470 | try name_map.ensureUnusedCapacity(arena, max_param_count); | 7470 | try name_map.ensureUnusedCapacity(arena, max_param_count); |
| 7471 | 7471 | ||
| 7472 | var rw_extra_i = extra_i; | 7472 | var rw_extra_i = extra_i; |
src/codegen/llvm/Builder.zig+6-6| ... | @@ -3994,7 +3994,7 @@ pub const Function = struct { | ... | @@ -3994,7 +3994,7 @@ pub const Function = struct { |
| 3994 | names: [*]const String = &[0]String{}, | 3994 | names: [*]const String = &[0]String{}, |
| 3995 | value_indices: [*]const u32 = &[0]u32{}, | 3995 | value_indices: [*]const u32 = &[0]u32{}, |
| 3996 | strip: bool, | 3996 | strip: bool, |
| 3997 | debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}, | 3997 | debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty, |
| 3998 | debug_values: []const Instruction.Index = &.{}, | 3998 | debug_values: []const Instruction.Index = &.{}, |
| 3999 | extra: []const u32 = &.{}, | 3999 | extra: []const u32 = &.{}, |
| 4000 | 4000 | ||
| ... | @@ -6166,7 +6166,7 @@ pub const WipFunction = struct { | ... | @@ -6166,7 +6166,7 @@ pub const WipFunction = struct { |
| 6166 | const value_indices = try gpa.alloc(u32, final_instructions_len); | 6166 | const value_indices = try gpa.alloc(u32, final_instructions_len); |
| 6167 | errdefer gpa.free(value_indices); | 6167 | errdefer gpa.free(value_indices); |
| 6168 | 6168 | ||
| 6169 | var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}; | 6169 | var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty; |
| 6170 | errdefer debug_locations.deinit(gpa); | 6170 | errdefer debug_locations.deinit(gpa); |
| 6171 | try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count())); | 6171 | try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count())); |
| 6172 | 6172 | ||
| ... | @@ -9557,7 +9557,7 @@ pub fn printUnbuffered( | ... | @@ -9557,7 +9557,7 @@ pub fn printUnbuffered( |
| 9557 | } | 9557 | } |
| 9558 | } | 9558 | } |
| 9559 | 9559 | ||
| 9560 | var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .{}; | 9560 | var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty; |
| 9561 | defer attribute_groups.deinit(self.gpa); | 9561 | defer attribute_groups.deinit(self.gpa); |
| 9562 | 9562 | ||
| 9563 | for (0.., self.functions.items) |function_i, function| { | 9563 | for (0.., self.functions.items) |function_i, function| { |
| ... | @@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co | ... | @@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 13133 | // Write LLVM IR magic | 13133 | // Write LLVM IR magic |
| 13134 | try bitcode.writeBits(ir.MAGIC, 32); | 13134 | try bitcode.writeBits(ir.MAGIC, 32); |
| 13135 | 13135 | ||
| 13136 | var record: std.ArrayListUnmanaged(u64) = .{}; | 13136 | var record: std.ArrayListUnmanaged(u64) = .empty; |
| 13137 | defer record.deinit(self.gpa); | 13137 | defer record.deinit(self.gpa); |
| 13138 | 13138 | ||
| 13139 | // IDENTIFICATION_BLOCK | 13139 | // IDENTIFICATION_BLOCK |
| ... | @@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co | ... | @@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 13524 | try paramattr_block.end(); | 13524 | try paramattr_block.end(); |
| 13525 | } | 13525 | } |
| 13526 | 13526 | ||
| 13527 | var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .{}; | 13527 | var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty; |
| 13528 | defer globals.deinit(self.gpa); | 13528 | defer globals.deinit(self.gpa); |
| 13529 | try globals.ensureUnusedCapacity( | 13529 | try globals.ensureUnusedCapacity( |
| 13530 | self.gpa, | 13530 | self.gpa, |
| ... | @@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co | ... | @@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co |
| 13587 | 13587 | ||
| 13588 | // Globals | 13588 | // Globals |
| 13589 | { | 13589 | { |
| 13590 | var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .{}; | 13590 | var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty; |
| 13591 | defer section_map.deinit(self.gpa); | 13591 | defer section_map.deinit(self.gpa); |
| 13592 | try section_map.ensureUnusedCapacity(self.gpa, globals.count()); | 13592 | try section_map.ensureUnusedCapacity(self.gpa, globals.count()); |
| 13593 | 13593 |
src/codegen/spirv.zig+10-10| ... | @@ -79,7 +79,7 @@ const ControlFlow = union(enum) { | ... | @@ -79,7 +79,7 @@ const ControlFlow = union(enum) { |
| 79 | selection: struct { | 79 | selection: struct { |
| 80 | /// In order to know which merges we still need to do, we need to keep | 80 | /// In order to know which merges we still need to do, we need to keep |
| 81 | /// a stack of those. | 81 | /// a stack of those. |
| 82 | merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .{}, | 82 | merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .empty, |
| 83 | }, | 83 | }, |
| 84 | /// For a `loop` type block, we can early-exit the block by | 84 | /// For a `loop` type block, we can early-exit the block by |
| 85 | /// jumping to the loop exit node, and we don't need to generate | 85 | /// jumping to the loop exit node, and we don't need to generate |
| ... | @@ -87,7 +87,7 @@ const ControlFlow = union(enum) { | ... | @@ -87,7 +87,7 @@ const ControlFlow = union(enum) { |
| 87 | loop: struct { | 87 | loop: struct { |
| 88 | /// The next block to jump to can be determined from any number | 88 | /// The next block to jump to can be determined from any number |
| 89 | /// of conditions that jump to the loop exit. | 89 | /// of conditions that jump to the loop exit. |
| 90 | merges: std.ArrayListUnmanaged(Incoming) = .{}, | 90 | merges: std.ArrayListUnmanaged(Incoming) = .empty, |
| 91 | /// The label id of the loop's merge block. | 91 | /// The label id of the loop's merge block. |
| 92 | merge_block: IdRef, | 92 | merge_block: IdRef, |
| 93 | }, | 93 | }, |
| ... | @@ -102,10 +102,10 @@ const ControlFlow = union(enum) { | ... | @@ -102,10 +102,10 @@ const ControlFlow = union(enum) { |
| 102 | }; | 102 | }; |
| 103 | /// The stack of (structured) blocks that we are currently in. This determines | 103 | /// The stack of (structured) blocks that we are currently in. This determines |
| 104 | /// how exits from the current block must be handled. | 104 | /// how exits from the current block must be handled. |
| 105 | block_stack: std.ArrayListUnmanaged(*Structured.Block) = .{}, | 105 | block_stack: std.ArrayListUnmanaged(*Structured.Block) = .empty, |
| 106 | /// Maps `block` inst indices to the variable that the block's result | 106 | /// Maps `block` inst indices to the variable that the block's result |
| 107 | /// value must be written to. | 107 | /// value must be written to. |
| 108 | block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .{}, | 108 | block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .empty, |
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | const Unstructured = struct { | 111 | const Unstructured = struct { |
| ... | @@ -116,12 +116,12 @@ const ControlFlow = union(enum) { | ... | @@ -116,12 +116,12 @@ const ControlFlow = union(enum) { |
| 116 | 116 | ||
| 117 | const Block = struct { | 117 | const Block = struct { |
| 118 | label: ?IdRef = null, | 118 | label: ?IdRef = null, |
| 119 | incoming_blocks: std.ArrayListUnmanaged(Incoming) = .{}, | 119 | incoming_blocks: std.ArrayListUnmanaged(Incoming) = .empty, |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | /// We need to keep track of result ids for block labels, as well as the 'incoming' | 122 | /// We need to keep track of result ids for block labels, as well as the 'incoming' |
| 123 | /// blocks for a block. | 123 | /// blocks for a block. |
| 124 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .{}, | 124 | blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .empty, |
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| 127 | structured: Structured, | 127 | structured: Structured, |
| ... | @@ -153,10 +153,10 @@ pub const Object = struct { | ... | @@ -153,10 +153,10 @@ pub const Object = struct { |
| 153 | 153 | ||
| 154 | /// The Zig module that this object file is generated for. | 154 | /// The Zig module that this object file is generated for. |
| 155 | /// A map of Zig decl indices to SPIR-V decl indices. | 155 | /// 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, |
| 157 | 157 | ||
| 158 | /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices. | 158 | /// 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, |
| 160 | 160 | ||
| 161 | /// A map that maps AIR intern pool indices to SPIR-V result-ids. | 161 | /// A map that maps AIR intern pool indices to SPIR-V result-ids. |
| 162 | intern_map: InternMap = .{}, | 162 | intern_map: InternMap = .{}, |
| ... | @@ -300,7 +300,7 @@ const NavGen = struct { | ... | @@ -300,7 +300,7 @@ const NavGen = struct { |
| 300 | 300 | ||
| 301 | /// An array of function argument result-ids. Each index corresponds with the | 301 | /// An array of function argument result-ids. Each index corresponds with the |
| 302 | /// function argument of the same index. | 302 | /// function argument of the same index. |
| 303 | args: std.ArrayListUnmanaged(IdRef) = .{}, | 303 | args: std.ArrayListUnmanaged(IdRef) = .empty, |
| 304 | 304 | ||
| 305 | /// A counter to keep track of how many `arg` instructions we've seen yet. | 305 | /// A counter to keep track of how many `arg` instructions we've seen yet. |
| 306 | next_arg_index: u32 = 0, | 306 | next_arg_index: u32 = 0, |
| ... | @@ -6270,7 +6270,7 @@ const NavGen = struct { | ... | @@ -6270,7 +6270,7 @@ const NavGen = struct { |
| 6270 | } | 6270 | } |
| 6271 | } | 6271 | } |
| 6272 | 6272 | ||
| 6273 | var incoming_structured_blocks = std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming){}; | 6273 | var incoming_structured_blocks: std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming) = .empty; |
| 6274 | defer incoming_structured_blocks.deinit(self.gpa); | 6274 | defer incoming_structured_blocks.deinit(self.gpa); |
| 6275 | 6275 | ||
| 6276 | if (self.control_flow == .structured) { | 6276 | if (self.control_flow == .structured) { |
src/codegen/spirv/Assembler.zig+5-5| ... | @@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue); | ... | @@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue); |
| 148 | gpa: Allocator, | 148 | gpa: Allocator, |
| 149 | 149 | ||
| 150 | /// A list of errors that occured during processing the assembly. | 150 | /// A list of errors that occured during processing the assembly. |
| 151 | errors: std.ArrayListUnmanaged(ErrorMsg) = .{}, | 151 | errors: std.ArrayListUnmanaged(ErrorMsg) = .empty, |
| 152 | 152 | ||
| 153 | /// The source code that is being assembled. | 153 | /// The source code that is being assembled. |
| 154 | src: []const u8, | 154 | src: []const u8, |
| ... | @@ -161,7 +161,7 @@ spv: *SpvModule, | ... | @@ -161,7 +161,7 @@ spv: *SpvModule, |
| 161 | func: *SpvModule.Fn, | 161 | func: *SpvModule.Fn, |
| 162 | 162 | ||
| 163 | /// `self.src` tokenized. | 163 | /// `self.src` tokenized. |
| 164 | tokens: std.ArrayListUnmanaged(Token) = .{}, | 164 | tokens: std.ArrayListUnmanaged(Token) = .empty, |
| 165 | 165 | ||
| 166 | /// The token that is next during parsing. | 166 | /// The token that is next during parsing. |
| 167 | current_token: u32 = 0, | 167 | current_token: u32 = 0, |
| ... | @@ -172,9 +172,9 @@ inst: struct { | ... | @@ -172,9 +172,9 @@ inst: struct { |
| 172 | /// The opcode of the current instruction. | 172 | /// The opcode of the current instruction. |
| 173 | opcode: Opcode = undefined, | 173 | opcode: Opcode = undefined, |
| 174 | /// Operands of the current instruction. | 174 | /// Operands of the current instruction. |
| 175 | operands: std.ArrayListUnmanaged(Operand) = .{}, | 175 | operands: std.ArrayListUnmanaged(Operand) = .empty, |
| 176 | /// This is where string data resides. Strings are zero-terminated. | 176 | /// This is where string data resides. Strings are zero-terminated. |
| 177 | string_bytes: std.ArrayListUnmanaged(u8) = .{}, | 177 | string_bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 178 | 178 | ||
| 179 | /// Return a reference to the result of this instruction, if any. | 179 | /// Return a reference to the result of this instruction, if any. |
| 180 | fn result(self: @This()) ?AsmValue.Ref { | 180 | fn result(self: @This()) ?AsmValue.Ref { |
| ... | @@ -196,7 +196,7 @@ value_map: AsmValueMap = .{}, | ... | @@ -196,7 +196,7 @@ value_map: AsmValueMap = .{}, |
| 196 | /// This set is used to quickly transform from an opcode name to the | 196 | /// This set is used to quickly transform from an opcode name to the |
| 197 | /// index in its instruction set. The index of the key is the | 197 | /// index in its instruction set. The index of the key is the |
| 198 | /// index in `spec.InstructionSet.core.instructions()`. | 198 | /// index in `spec.InstructionSet.core.instructions()`. |
| 199 | instruction_map: std.StringArrayHashMapUnmanaged(void) = .{}, | 199 | instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 200 | 200 | ||
| 201 | /// Free the resources owned by this assembler. | 201 | /// Free the resources owned by this assembler. |
| 202 | pub fn deinit(self: *Assembler) void { | 202 | pub fn deinit(self: *Assembler) void { |
src/codegen/spirv/Module.zig+10-10| ... | @@ -35,7 +35,7 @@ pub const Fn = struct { | ... | @@ -35,7 +35,7 @@ pub const Fn = struct { |
| 35 | /// the end of this function definition. | 35 | /// the end of this function definition. |
| 36 | body: Section = .{}, | 36 | body: Section = .{}, |
| 37 | /// The decl dependencies that this function depends on. | 37 | /// 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, |
| 39 | 39 | ||
| 40 | /// Reset this function without deallocating resources, so that | 40 | /// Reset this function without deallocating resources, so that |
| 41 | /// it may be used to emit code for another function. | 41 | /// it may be used to emit code for another function. |
| ... | @@ -141,7 +141,7 @@ sections: struct { | ... | @@ -141,7 +141,7 @@ sections: struct { |
| 141 | next_result_id: Word, | 141 | next_result_id: Word, |
| 142 | 142 | ||
| 143 | /// Cache for results of OpString instructions. | 143 | /// Cache for results of OpString instructions. |
| 144 | strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, | 144 | strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty, |
| 145 | 145 | ||
| 146 | /// Some types shouldn't be emitted more than one time, but cannot be caught by | 146 | /// Some types shouldn't be emitted more than one time, but cannot be caught by |
| 147 | /// the `intern_map` during codegen. Sometimes, IDs are compared to check if | 147 | /// the `intern_map` during codegen. Sometimes, IDs are compared to check if |
| ... | @@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, | ... | @@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, |
| 154 | cache: struct { | 154 | cache: struct { |
| 155 | bool_type: ?IdRef = null, | 155 | bool_type: ?IdRef = null, |
| 156 | void_type: ?IdRef = null, | 156 | void_type: ?IdRef = null, |
| 157 | int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{}, | 157 | int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty, |
| 158 | float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{}, | 158 | float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty, |
| 159 | // This cache is required so that @Vector(X, u1) in direct representation has the | 159 | // This cache is required so that @Vector(X, u1) in direct representation has the |
| 160 | // same ID as @Vector(X, bool) in indirect representation. | 160 | // 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, |
| 162 | 162 | ||
| 163 | builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{}, | 163 | builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty, |
| 164 | } = .{}, | 164 | } = .{}, |
| 165 | 165 | ||
| 166 | /// Set of Decls, referred to by Decl.Index. | 166 | /// Set of Decls, referred to by Decl.Index. |
| 167 | decls: std.ArrayListUnmanaged(Decl) = .{}, | 167 | decls: std.ArrayListUnmanaged(Decl) = .empty, |
| 168 | 168 | ||
| 169 | /// List of dependencies, per decl. This list holds all the dependencies, sliced by the | 169 | /// List of dependencies, per decl. This list holds all the dependencies, sliced by the |
| 170 | /// begin_dep and end_dep in `self.decls`. | 170 | /// begin_dep and end_dep in `self.decls`. |
| 171 | decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{}, | 171 | decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty, |
| 172 | 172 | ||
| 173 | /// The list of entry points that should be exported from this module. | 173 | /// The list of entry points that should be exported from this module. |
| 174 | entry_points: std.ArrayListUnmanaged(EntryPoint) = .{}, | 174 | entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty, |
| 175 | 175 | ||
| 176 | /// The list of extended instruction sets that should be imported. | 176 | /// The list of extended instruction sets that should be imported. |
| 177 | extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{}, | 177 | extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty, |
| 178 | 178 | ||
| 179 | pub fn init(gpa: Allocator) Module { | 179 | pub fn init(gpa: Allocator) Module { |
| 180 | return .{ | 180 | return .{ |
src/codegen/spirv/Section.zig+1-1| ... | @@ -15,7 +15,7 @@ const Opcode = spec.Opcode; | ... | @@ -15,7 +15,7 @@ const Opcode = spec.Opcode; |
| 15 | 15 | ||
| 16 | /// The instructions in this section. Memory is owned by the Module | 16 | /// The instructions in this section. Memory is owned by the Module |
| 17 | /// externally associated to this Section. | 17 | /// externally associated to this Section. |
| 18 | instructions: std.ArrayListUnmanaged(Word) = .{}, | 18 | instructions: std.ArrayListUnmanaged(Word) = .empty, |
| 19 | 19 | ||
| 20 | pub fn deinit(section: *Section, allocator: Allocator) void { | 20 | pub fn deinit(section: *Section, allocator: Allocator) void { |
| 21 | section.instructions.deinit(allocator); | 21 | section.instructions.deinit(allocator); |
src/link/C.zig+15-15| ... | @@ -26,34 +26,34 @@ base: link.File, | ... | @@ -26,34 +26,34 @@ base: link.File, |
| 26 | /// This linker backend does not try to incrementally link output C source code. | 26 | /// This linker backend does not try to incrementally link output C source code. |
| 27 | /// Instead, it tracks all declarations in this table, and iterates over it | 27 | /// Instead, it tracks all declarations in this table, and iterates over it |
| 28 | /// in the flush function, stitching pre-rendered pieces of C code together. | 28 | /// in the flush function, stitching pre-rendered pieces of C code together. |
| 29 | navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .{}, | 29 | navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .empty, |
| 30 | /// All the string bytes of rendered C code, all squished into one array. | 30 | /// All the string bytes of rendered C code, all squished into one array. |
| 31 | /// While in progress, a separate buffer is used, and then when finished, the | 31 | /// While in progress, a separate buffer is used, and then when finished, the |
| 32 | /// buffer is copied into this one. | 32 | /// buffer is copied into this one. |
| 33 | string_bytes: std.ArrayListUnmanaged(u8) = .{}, | 33 | string_bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 34 | /// Tracks all the anonymous decls that are used by all the decls so they can | 34 | /// Tracks all the anonymous decls that are used by all the decls so they can |
| 35 | /// be rendered during flush(). | 35 | /// be rendered during flush(). |
| 36 | uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .{}, | 36 | uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .empty, |
| 37 | /// Sparse set of uavs that are overaligned. Underaligned anon decls are | 37 | /// Sparse set of uavs that are overaligned. Underaligned anon decls are |
| 38 | /// lowered the same as ABI-aligned anon decls. The keys here are a subset of | 38 | /// lowered the same as ABI-aligned anon decls. The keys here are a subset of |
| 39 | /// the keys of `uavs`. | 39 | /// the keys of `uavs`. |
| 40 | aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .{}, | 40 | aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty, |
| 41 | 41 | ||
| 42 | exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .{}, | 42 | exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .empty, |
| 43 | exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .{}, | 43 | exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .empty, |
| 44 | 44 | ||
| 45 | /// Optimization, `updateDecl` reuses this buffer rather than creating a new | 45 | /// Optimization, `updateDecl` reuses this buffer rather than creating a new |
| 46 | /// one with every call. | 46 | /// one with every call. |
| 47 | fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, | 47 | fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 48 | /// Optimization, `updateDecl` reuses this buffer rather than creating a new | 48 | /// Optimization, `updateDecl` reuses this buffer rather than creating a new |
| 49 | /// one with every call. | 49 | /// one with every call. |
| 50 | code_buf: std.ArrayListUnmanaged(u8) = .{}, | 50 | code_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 51 | /// Optimization, `flush` reuses this buffer rather than creating a new | 51 | /// Optimization, `flush` reuses this buffer rather than creating a new |
| 52 | /// one with every call. | 52 | /// one with every call. |
| 53 | lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, | 53 | lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 54 | /// Optimization, `flush` reuses this buffer rather than creating a new | 54 | /// Optimization, `flush` reuses this buffer rather than creating a new |
| 55 | /// one with every call. | 55 | /// one with every call. |
| 56 | lazy_code_buf: std.ArrayListUnmanaged(u8) = .{}, | 56 | lazy_code_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 57 | 57 | ||
| 58 | /// A reference into `string_bytes`. | 58 | /// A reference into `string_bytes`. |
| 59 | const String = extern struct { | 59 | const String = extern struct { |
| ... | @@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: | ... | @@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: |
| 469 | // `CType`s, forward decls, and non-functions first. | 469 | // `CType`s, forward decls, and non-functions first. |
| 470 | 470 | ||
| 471 | { | 471 | { |
| 472 | var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; | 472 | var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; |
| 473 | defer export_names.deinit(gpa); | 473 | defer export_names.deinit(gpa); |
| 474 | try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count())); | 474 | try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count())); |
| 475 | for (zcu.single_exports.values()) |export_index| { | 475 | for (zcu.single_exports.values()) |export_index| { |
| ... | @@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: | ... | @@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: |
| 559 | 559 | ||
| 560 | const Flush = struct { | 560 | const Flush = struct { |
| 561 | ctype_pool: codegen.CType.Pool, | 561 | ctype_pool: codegen.CType.Pool, |
| 562 | ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .{}, | 562 | ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .empty, |
| 563 | ctypes_buf: std.ArrayListUnmanaged(u8) = .{}, | 563 | ctypes_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 564 | 564 | ||
| 565 | lazy_ctype_pool: codegen.CType.Pool, | 565 | lazy_ctype_pool: codegen.CType.Pool, |
| 566 | lazy_fns: LazyFns = .{}, | 566 | lazy_fns: LazyFns = .{}, |
| 567 | 567 | ||
| 568 | asm_buf: std.ArrayListUnmanaged(u8) = .{}, | 568 | asm_buf: std.ArrayListUnmanaged(u8) = .empty, |
| 569 | 569 | ||
| 570 | /// We collect a list of buffers to write, and write them all at once with pwritev 😎 | 570 | /// 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, |
| 572 | /// Keeps track of the total bytes of `all_buffers`. | 572 | /// Keeps track of the total bytes of `all_buffers`. |
| 573 | file_size: u64 = 0, | 573 | file_size: u64 = 0, |
| 574 | 574 |
src/link/Coff.zig+13-13| ... | @@ -26,7 +26,7 @@ repro: bool, | ... | @@ -26,7 +26,7 @@ repro: bool, |
| 26 | ptr_width: PtrWidth, | 26 | ptr_width: PtrWidth, |
| 27 | page_size: u32, | 27 | page_size: u32, |
| 28 | 28 | ||
| 29 | objects: std.ArrayListUnmanaged(Object) = .{}, | 29 | objects: std.ArrayListUnmanaged(Object) = .empty, |
| 30 | 30 | ||
| 31 | sections: std.MultiArrayList(Section) = .{}, | 31 | sections: std.MultiArrayList(Section) = .{}, |
| 32 | data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory, | 32 | data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory, |
| ... | @@ -38,14 +38,14 @@ data_section_index: ?u16 = null, | ... | @@ -38,14 +38,14 @@ data_section_index: ?u16 = null, |
| 38 | reloc_section_index: ?u16 = null, | 38 | reloc_section_index: ?u16 = null, |
| 39 | idata_section_index: ?u16 = null, | 39 | idata_section_index: ?u16 = null, |
| 40 | 40 | ||
| 41 | locals: std.ArrayListUnmanaged(coff.Symbol) = .{}, | 41 | locals: std.ArrayListUnmanaged(coff.Symbol) = .empty, |
| 42 | globals: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, | 42 | globals: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, |
| 43 | resolver: std.StringHashMapUnmanaged(u32) = .{}, | 43 | resolver: std.StringHashMapUnmanaged(u32) = .empty, |
| 44 | unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .{}, | 44 | unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .empty, |
| 45 | need_got_table: std.AutoHashMapUnmanaged(u32, void) = .{}, | 45 | need_got_table: std.AutoHashMapUnmanaged(u32, void) = .empty, |
| 46 | 46 | ||
| 47 | locals_free_list: std.ArrayListUnmanaged(u32) = .{}, | 47 | locals_free_list: std.ArrayListUnmanaged(u32) = .empty, |
| 48 | globals_free_list: std.ArrayListUnmanaged(u32) = .{}, | 48 | globals_free_list: std.ArrayListUnmanaged(u32) = .empty, |
| 49 | 49 | ||
| 50 | strtab: StringTable = .{}, | 50 | strtab: StringTable = .{}, |
| 51 | strtab_offset: ?u32 = null, | 51 | strtab_offset: ?u32 = null, |
| ... | @@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{}, | ... | @@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{}, |
| 56 | 56 | ||
| 57 | /// A table of ImportTables partitioned by the library name. | 57 | /// A table of ImportTables partitioned by the library name. |
| 58 | /// Key is an offset into the interning string table `temp_strtab`. | 58 | /// Key is an offset into the interning string table `temp_strtab`. |
| 59 | import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .{}, | 59 | import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .empty, |
| 60 | 60 | ||
| 61 | got_table_count_dirty: bool = true, | 61 | got_table_count_dirty: bool = true, |
| 62 | got_table_contents_dirty: bool = true, | 62 | got_table_contents_dirty: bool = true, |
| ... | @@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{}, | ... | @@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{}, |
| 69 | navs: NavTable = .{}, | 69 | navs: NavTable = .{}, |
| 70 | 70 | ||
| 71 | /// List of atoms that are either synthetic or map directly to the Zig source program. | 71 | /// List of atoms that are either synthetic or map directly to the Zig source program. |
| 72 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 72 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 73 | 73 | ||
| 74 | /// Table of atoms indexed by the symbol index. | 74 | /// Table of atoms indexed by the symbol index. |
| 75 | atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, | 75 | atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, |
| 76 | 76 | ||
| 77 | uavs: UavTable = .{}, | 77 | uavs: UavTable = .{}, |
| 78 | 78 | ||
| ... | @@ -131,7 +131,7 @@ const Section = struct { | ... | @@ -131,7 +131,7 @@ const Section = struct { |
| 131 | /// overcapacity can be negative. A simple way to have negative overcapacity is to | 131 | /// overcapacity can be negative. A simple way to have negative overcapacity is to |
| 132 | /// allocate a fresh atom, which will have ideal capacity, and then grow it | 132 | /// allocate a fresh atom, which will have ideal capacity, and then grow it |
| 133 | /// by 1 byte. It will then have -1 overcapacity. | 133 | /// by 1 byte. It will then have -1 overcapacity. |
| 134 | free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, | 134 | free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); | 137 | const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); |
| ... | @@ -148,7 +148,7 @@ const AvMetadata = struct { | ... | @@ -148,7 +148,7 @@ const AvMetadata = struct { |
| 148 | atom: Atom.Index, | 148 | atom: Atom.Index, |
| 149 | section: u16, | 149 | section: u16, |
| 150 | /// A list of all exports aliases of this Decl. | 150 | /// A list of all exports aliases of this Decl. |
| 151 | exports: std.ArrayListUnmanaged(u32) = .{}, | 151 | exports: std.ArrayListUnmanaged(u32) = .empty, |
| 152 | 152 | ||
| 153 | fn deinit(m: *AvMetadata, allocator: Allocator) void { | 153 | fn deinit(m: *AvMetadata, allocator: Allocator) void { |
| 154 | m.exports.deinit(allocator); | 154 | m.exports.deinit(allocator); |
src/link/Coff/ImportTable.zig+3-3| ... | @@ -26,9 +26,9 @@ | ... | @@ -26,9 +26,9 @@ |
| 26 | //! DLL#2 name | 26 | //! DLL#2 name |
| 27 | //! --- END | 27 | //! --- END |
| 28 | 28 | ||
| 29 | entries: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, | 29 | entries: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, |
| 30 | free_list: std.ArrayListUnmanaged(u32) = .{}, | 30 | free_list: std.ArrayListUnmanaged(u32) = .empty, |
| 31 | lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .{}, | 31 | lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .empty, |
| 32 | 32 | ||
| 33 | pub fn deinit(itab: *ImportTable, allocator: Allocator) void { | 33 | pub fn deinit(itab: *ImportTable, allocator: Allocator) void { |
| 34 | itab.entries.deinit(allocator); | 34 | itab.entries.deinit(allocator); |
src/link/Elf.zig+19-19| ... | @@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{}, | ... | @@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{}, |
| 39 | /// Long-lived list of all file descriptors. | 39 | /// Long-lived list of all file descriptors. |
| 40 | /// We store them globally rather than per actual File so that we can re-use | 40 | /// We store them globally rather than per actual File so that we can re-use |
| 41 | /// one file handle per every object file within an archive. | 41 | /// one file handle per every object file within an archive. |
| 42 | file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, | 42 | file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, |
| 43 | zig_object_index: ?File.Index = null, | 43 | zig_object_index: ?File.Index = null, |
| 44 | linker_defined_index: ?File.Index = null, | 44 | linker_defined_index: ?File.Index = null, |
| 45 | objects: std.ArrayListUnmanaged(File.Index) = .{}, | 45 | objects: std.ArrayListUnmanaged(File.Index) = .empty, |
| 46 | shared_objects: std.ArrayListUnmanaged(File.Index) = .{}, | 46 | shared_objects: std.ArrayListUnmanaged(File.Index) = .empty, |
| 47 | 47 | ||
| 48 | /// List of all output sections and their associated metadata. | 48 | /// List of all output sections and their associated metadata. |
| 49 | sections: std.MultiArrayList(Section) = .{}, | 49 | sections: std.MultiArrayList(Section) = .{}, |
| ... | @@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null, | ... | @@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null, |
| 52 | 52 | ||
| 53 | /// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write. | 53 | /// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write. |
| 54 | /// Same order as in the file. | 54 | /// Same order as in the file. |
| 55 | phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .{}, | 55 | phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .empty, |
| 56 | 56 | ||
| 57 | /// Special program headers | 57 | /// Special program headers |
| 58 | /// PT_PHDR | 58 | /// PT_PHDR |
| ... | @@ -77,23 +77,23 @@ page_size: u32, | ... | @@ -77,23 +77,23 @@ page_size: u32, |
| 77 | default_sym_version: elf.Elf64_Versym, | 77 | default_sym_version: elf.Elf64_Versym, |
| 78 | 78 | ||
| 79 | /// .shstrtab buffer | 79 | /// .shstrtab buffer |
| 80 | shstrtab: std.ArrayListUnmanaged(u8) = .{}, | 80 | shstrtab: std.ArrayListUnmanaged(u8) = .empty, |
| 81 | /// .symtab buffer | 81 | /// .symtab buffer |
| 82 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, | 82 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, |
| 83 | /// .strtab buffer | 83 | /// .strtab buffer |
| 84 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 84 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 85 | /// Dynamic symbol table. Only populated and emitted when linking dynamically. | 85 | /// Dynamic symbol table. Only populated and emitted when linking dynamically. |
| 86 | dynsym: DynsymSection = .{}, | 86 | dynsym: DynsymSection = .{}, |
| 87 | /// .dynstrtab buffer | 87 | /// .dynstrtab buffer |
| 88 | dynstrtab: std.ArrayListUnmanaged(u8) = .{}, | 88 | dynstrtab: std.ArrayListUnmanaged(u8) = .empty, |
| 89 | /// Version symbol table. Only populated and emitted when linking dynamically. | 89 | /// Version symbol table. Only populated and emitted when linking dynamically. |
| 90 | versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, | 90 | versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, |
| 91 | /// .verneed section | 91 | /// .verneed section |
| 92 | verneed: VerneedSection = .{}, | 92 | verneed: VerneedSection = .{}, |
| 93 | /// .got section | 93 | /// .got section |
| 94 | got: GotSection = .{}, | 94 | got: GotSection = .{}, |
| 95 | /// .rela.dyn section | 95 | /// .rela.dyn section |
| 96 | rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, | 96 | rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, |
| 97 | /// .dynamic section | 97 | /// .dynamic section |
| 98 | dynamic: DynamicSection = .{}, | 98 | dynamic: DynamicSection = .{}, |
| 99 | /// .hash section | 99 | /// .hash section |
| ... | @@ -109,10 +109,10 @@ plt_got: PltGotSection = .{}, | ... | @@ -109,10 +109,10 @@ plt_got: PltGotSection = .{}, |
| 109 | /// .copyrel section | 109 | /// .copyrel section |
| 110 | copy_rel: CopyRelSection = .{}, | 110 | copy_rel: CopyRelSection = .{}, |
| 111 | /// .rela.plt section | 111 | /// .rela.plt section |
| 112 | rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, | 112 | rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, |
| 113 | /// SHT_GROUP sections | 113 | /// SHT_GROUP sections |
| 114 | /// Applies only to a relocatable. | 114 | /// Applies only to a relocatable. |
| 115 | comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .{}, | 115 | comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .empty, |
| 116 | 116 | ||
| 117 | copy_rel_section_index: ?u32 = null, | 117 | copy_rel_section_index: ?u32 = null, |
| 118 | dynamic_section_index: ?u32 = null, | 118 | dynamic_section_index: ?u32 = null, |
| ... | @@ -143,10 +143,10 @@ has_text_reloc: bool = false, | ... | @@ -143,10 +143,10 @@ has_text_reloc: bool = false, |
| 143 | num_ifunc_dynrelocs: usize = 0, | 143 | num_ifunc_dynrelocs: usize = 0, |
| 144 | 144 | ||
| 145 | /// List of range extension thunks. | 145 | /// List of range extension thunks. |
| 146 | thunks: std.ArrayListUnmanaged(Thunk) = .{}, | 146 | thunks: std.ArrayListUnmanaged(Thunk) = .empty, |
| 147 | 147 | ||
| 148 | /// List of output merge sections with deduped contents. | 148 | /// List of output merge sections with deduped contents. |
| 149 | merge_sections: std.ArrayListUnmanaged(MergeSection) = .{}, | 149 | merge_sections: std.ArrayListUnmanaged(MergeSection) = .empty, |
| 150 | 150 | ||
| 151 | first_eflags: ?elf.Elf64_Word = null, | 151 | first_eflags: ?elf.Elf64_Word = null, |
| 152 | 152 | ||
| ... | @@ -5487,9 +5487,9 @@ pub const Ref = struct { | ... | @@ -5487,9 +5487,9 @@ pub const Ref = struct { |
| 5487 | }; | 5487 | }; |
| 5488 | 5488 | ||
| 5489 | pub const SymbolResolver = struct { | 5489 | pub const SymbolResolver = struct { |
| 5490 | keys: std.ArrayListUnmanaged(Key) = .{}, | 5490 | keys: std.ArrayListUnmanaged(Key) = .empty, |
| 5491 | values: std.ArrayListUnmanaged(Ref) = .{}, | 5491 | values: std.ArrayListUnmanaged(Ref) = .empty, |
| 5492 | table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, | 5492 | table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, |
| 5493 | 5493 | ||
| 5494 | const Result = struct { | 5494 | const Result = struct { |
| 5495 | found_existing: bool, | 5495 | found_existing: bool, |
| ... | @@ -5586,7 +5586,7 @@ const Section = struct { | ... | @@ -5586,7 +5586,7 @@ const Section = struct { |
| 5586 | /// List of atoms contributing to this section. | 5586 | /// List of atoms contributing to this section. |
| 5587 | /// TODO currently this is only used for relocations tracking in relocatable mode | 5587 | /// TODO currently this is only used for relocations tracking in relocatable mode |
| 5588 | /// but will be merged with atom_list_2. | 5588 | /// but will be merged with atom_list_2. |
| 5589 | atom_list: std.ArrayListUnmanaged(Ref) = .{}, | 5589 | atom_list: std.ArrayListUnmanaged(Ref) = .empty, |
| 5590 | 5590 | ||
| 5591 | /// List of atoms contributing to this section. | 5591 | /// List of atoms contributing to this section. |
| 5592 | /// This can be used by sections that require special handling such as init/fini array, etc. | 5592 | /// This can be used by sections that require special handling such as init/fini array, etc. |
| ... | @@ -5610,7 +5610,7 @@ const Section = struct { | ... | @@ -5610,7 +5610,7 @@ const Section = struct { |
| 5610 | /// overcapacity can be negative. A simple way to have negative overcapacity is to | 5610 | /// overcapacity can be negative. A simple way to have negative overcapacity is to |
| 5611 | /// allocate a fresh text block, which will have ideal capacity, and then grow it | 5611 | /// allocate a fresh text block, which will have ideal capacity, and then grow it |
| 5612 | /// by 1 byte. It will then have -1 overcapacity. | 5612 | /// by 1 byte. It will then have -1 overcapacity. |
| 5613 | free_list: std.ArrayListUnmanaged(Ref) = .{}, | 5613 | free_list: std.ArrayListUnmanaged(Ref) = .empty, |
| 5614 | }; | 5614 | }; |
| 5615 | 5615 | ||
| 5616 | fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 { | 5616 | fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 { |
src/link/Elf/Archive.zig+4-4| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | objects: std.ArrayListUnmanaged(Object) = .{}, | 1 | objects: std.ArrayListUnmanaged(Object) = .empty, |
| 2 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 2 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 3 | 3 | ||
| 4 | pub fn isArchive(path: []const u8) !bool { | 4 | pub fn isArchive(path: []const u8) !bool { |
| 5 | const file = try std.fs.cwd().openFile(path, .{}); | 5 | const file = try std.fs.cwd().openFile(path, .{}); |
| ... | @@ -127,7 +127,7 @@ const strtab_delimiter = '\n'; | ... | @@ -127,7 +127,7 @@ const strtab_delimiter = '\n'; |
| 127 | pub const max_member_name_len = 15; | 127 | pub const max_member_name_len = 15; |
| 128 | 128 | ||
| 129 | pub const ArSymtab = struct { | 129 | pub const ArSymtab = struct { |
| 130 | symtab: std.ArrayListUnmanaged(Entry) = .{}, | 130 | symtab: std.ArrayListUnmanaged(Entry) = .empty, |
| 131 | strtab: StringTable = .{}, | 131 | strtab: StringTable = .{}, |
| 132 | 132 | ||
| 133 | pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { | 133 | pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { |
| ... | @@ -241,7 +241,7 @@ pub const ArSymtab = struct { | ... | @@ -241,7 +241,7 @@ pub const ArSymtab = struct { |
| 241 | }; | 241 | }; |
| 242 | 242 | ||
| 243 | pub const ArStrtab = struct { | 243 | pub const ArStrtab = struct { |
| 244 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 244 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 245 | 245 | ||
| 246 | pub fn deinit(ar: *ArStrtab, allocator: Allocator) void { | 246 | pub fn deinit(ar: *ArStrtab, allocator: Allocator) void { |
| 247 | ar.buffer.deinit(allocator); | 247 | ar.buffer.deinit(allocator); |
src/link/Elf/AtomList.zig+1-1| ... | @@ -2,7 +2,7 @@ value: i64 = 0, | ... | @@ -2,7 +2,7 @@ value: i64 = 0, |
| 2 | size: u64 = 0, | 2 | size: u64 = 0, |
| 3 | alignment: Atom.Alignment = .@"1", | 3 | alignment: Atom.Alignment = .@"1", |
| 4 | output_section_index: u32 = 0, | 4 | output_section_index: u32 = 0, |
| 5 | atoms: std.ArrayListUnmanaged(Elf.Ref) = .{}, | 5 | atoms: std.ArrayListUnmanaged(Elf.Ref) = .empty, |
| 6 | 6 | ||
| 7 | pub fn deinit(list: *AtomList, allocator: Allocator) void { | 7 | pub fn deinit(list: *AtomList, allocator: Allocator) void { |
| 8 | list.atoms.deinit(allocator); | 8 | list.atoms.deinit(allocator); |
src/link/Elf/LdScript.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | path: []const u8, | 1 | path: []const u8, |
| 2 | cpu_arch: ?std.Target.Cpu.Arch = null, | 2 | cpu_arch: ?std.Target.Cpu.Arch = null, |
| 3 | args: std.ArrayListUnmanaged(Elf.SystemLib) = .{}, | 3 | args: std.ArrayListUnmanaged(Elf.SystemLib) = .empty, |
| 4 | 4 | ||
| 5 | pub fn deinit(scr: *LdScript, allocator: Allocator) void { | 5 | pub fn deinit(scr: *LdScript, allocator: Allocator) void { |
| 6 | scr.args.deinit(allocator); | 6 | scr.args.deinit(allocator); |
src/link/Elf/LinkerDefined.zig+6-6| ... | @@ -1,11 +1,11 @@ | ... | @@ -1,11 +1,11 @@ |
| 1 | index: File.Index, | 1 | index: File.Index, |
| 2 | 2 | ||
| 3 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, | 3 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, |
| 4 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 4 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 5 | 5 | ||
| 6 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 6 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 7 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 7 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 8 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, | 8 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, |
| 9 | 9 | ||
| 10 | entry_index: ?Symbol.Index = null, | 10 | entry_index: ?Symbol.Index = null, |
| 11 | dynamic_index: ?Symbol.Index = null, | 11 | dynamic_index: ?Symbol.Index = null, |
| ... | @@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null, | ... | @@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null, |
| 24 | rela_iplt_start_index: ?Symbol.Index = null, | 24 | rela_iplt_start_index: ?Symbol.Index = null, |
| 25 | rela_iplt_end_index: ?Symbol.Index = null, | 25 | rela_iplt_end_index: ?Symbol.Index = null, |
| 26 | global_pointer_index: ?Symbol.Index = null, | 26 | global_pointer_index: ?Symbol.Index = null, |
| 27 | start_stop_indexes: std.ArrayListUnmanaged(u32) = .{}, | 27 | start_stop_indexes: std.ArrayListUnmanaged(u32) = .empty, |
| 28 | 28 | ||
| 29 | output_symtab_ctx: Elf.SymtabCtx = .{}, | 29 | output_symtab_ctx: Elf.SymtabCtx = .{}, |
| 30 | 30 |
src/link/Elf/Object.zig+17-17| ... | @@ -4,29 +4,29 @@ file_handle: File.HandleIndex, | ... | @@ -4,29 +4,29 @@ file_handle: File.HandleIndex, |
| 4 | index: File.Index, | 4 | index: File.Index, |
| 5 | 5 | ||
| 6 | header: ?elf.Elf64_Ehdr = null, | 6 | header: ?elf.Elf64_Ehdr = null, |
| 7 | shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, | 7 | shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, |
| 8 | 8 | ||
| 9 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, | 9 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, |
| 10 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 10 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 11 | first_global: ?Symbol.Index = null, | 11 | first_global: ?Symbol.Index = null, |
| 12 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 12 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 13 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 13 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 14 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, | 14 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, |
| 15 | relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, | 15 | relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, |
| 16 | 16 | ||
| 17 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 17 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 18 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, | 18 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 19 | atoms_extra: std.ArrayListUnmanaged(u32) = .{}, | 19 | atoms_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 20 | 20 | ||
| 21 | comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .{}, | 21 | comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .empty, |
| 22 | comdat_group_data: std.ArrayListUnmanaged(u32) = .{}, | 22 | comdat_group_data: std.ArrayListUnmanaged(u32) = .empty, |
| 23 | 23 | ||
| 24 | input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .{}, | 24 | input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .empty, |
| 25 | input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .{}, | 25 | input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .empty, |
| 26 | 26 | ||
| 27 | fdes: std.ArrayListUnmanaged(Fde) = .{}, | 27 | fdes: std.ArrayListUnmanaged(Fde) = .empty, |
| 28 | cies: std.ArrayListUnmanaged(Cie) = .{}, | 28 | cies: std.ArrayListUnmanaged(Cie) = .empty, |
| 29 | eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, | 29 | eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, |
| 30 | 30 | ||
| 31 | alive: bool = true, | 31 | alive: bool = true, |
| 32 | num_dynrelocs: u32 = 0, | 32 | num_dynrelocs: u32 = 0, |
src/link/Elf/SharedObject.zig+9-9| ... | @@ -2,20 +2,20 @@ path: []const u8, | ... | @@ -2,20 +2,20 @@ path: []const u8, |
| 2 | index: File.Index, | 2 | index: File.Index, |
| 3 | 3 | ||
| 4 | header: ?elf.Elf64_Ehdr = null, | 4 | header: ?elf.Elf64_Ehdr = null, |
| 5 | shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, | 5 | shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, |
| 6 | 6 | ||
| 7 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, | 7 | symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, |
| 8 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 8 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 9 | /// Version symtab contains version strings of the symbols if present. | 9 | /// Version symtab contains version strings of the symbols if present. |
| 10 | versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, | 10 | versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, |
| 11 | verstrings: std.ArrayListUnmanaged(u32) = .{}, | 11 | verstrings: std.ArrayListUnmanaged(u32) = .empty, |
| 12 | 12 | ||
| 13 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 13 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 15 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, | 15 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, |
| 16 | 16 | ||
| 17 | aliases: ?std.ArrayListUnmanaged(u32) = null, | 17 | aliases: ?std.ArrayListUnmanaged(u32) = null, |
| 18 | dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{}, | 18 | dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty, |
| 19 | 19 | ||
| 20 | needed: bool, | 20 | needed: bool, |
| 21 | alive: bool, | 21 | alive: bool, |
src/link/Elf/Thunk.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | value: i64 = 0, | 1 | value: i64 = 0, |
| 2 | output_section_index: u32 = 0, | 2 | output_section_index: u32 = 0, |
| 3 | symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{}, | 3 | symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, |
| 4 | output_symtab_ctx: Elf.SymtabCtx = .{}, | 4 | output_symtab_ctx: Elf.SymtabCtx = .{}, |
| 5 | 5 | ||
| 6 | pub fn deinit(thunk: *Thunk, allocator: Allocator) void { | 6 | pub fn deinit(thunk: *Thunk, allocator: Allocator) void { |
src/link/Elf/ZigObject.zig+13-13| ... | @@ -3,24 +3,24 @@ | ... | @@ -3,24 +3,24 @@ |
| 3 | //! and any relocations that may have been emitted. | 3 | //! and any relocations that may have been emitted. |
| 4 | //! Think about this as fake in-memory Object file for the Zig module. | 4 | //! Think about this as fake in-memory Object file for the Zig module. |
| 5 | 5 | ||
| 6 | data: std.ArrayListUnmanaged(u8) = .{}, | 6 | data: std.ArrayListUnmanaged(u8) = .empty, |
| 7 | /// Externally owned memory. | 7 | /// Externally owned memory. |
| 8 | path: []const u8, | 8 | path: []const u8, |
| 9 | index: File.Index, | 9 | index: File.Index, |
| 10 | 10 | ||
| 11 | symtab: std.MultiArrayList(ElfSym) = .{}, | 11 | symtab: std.MultiArrayList(ElfSym) = .{}, |
| 12 | strtab: StringTable = .{}, | 12 | strtab: StringTable = .{}, |
| 13 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 13 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 15 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, | 15 | symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, |
| 16 | local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 16 | local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 17 | global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 17 | global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 18 | globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, | 18 | globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, |
| 19 | 19 | ||
| 20 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 20 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 21 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, | 21 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 22 | atoms_extra: std.ArrayListUnmanaged(u32) = .{}, | 22 | atoms_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 23 | relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .{}, | 23 | relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .empty, |
| 24 | 24 | ||
| 25 | num_dynrelocs: u32 = 0, | 25 | num_dynrelocs: u32 = 0, |
| 26 | 26 | ||
| ... | @@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct { | ... | @@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct { |
| 2313 | const AvMetadata = struct { | 2313 | const AvMetadata = struct { |
| 2314 | symbol_index: Symbol.Index, | 2314 | symbol_index: Symbol.Index, |
| 2315 | /// A list of all exports aliases of this Av. | 2315 | /// A list of all exports aliases of this Av. |
| 2316 | exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 2316 | exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 2317 | /// Set to true if the AV has been initialized and allocated. | 2317 | /// Set to true if the AV has been initialized and allocated. |
| 2318 | allocated: bool = false, | 2318 | allocated: bool = false, |
| 2319 | 2319 |
src/link/Elf/merge_section.zig+7-7| ... | @@ -7,15 +7,15 @@ pub const MergeSection = struct { | ... | @@ -7,15 +7,15 @@ pub const MergeSection = struct { |
| 7 | type: u32 = 0, | 7 | type: u32 = 0, |
| 8 | flags: u64 = 0, | 8 | flags: u64 = 0, |
| 9 | output_section_index: u32 = 0, | 9 | output_section_index: u32 = 0, |
| 10 | bytes: std.ArrayListUnmanaged(u8) = .{}, | 10 | bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 11 | table: std.HashMapUnmanaged( | 11 | table: std.HashMapUnmanaged( |
| 12 | String, | 12 | String, |
| 13 | MergeSubsection.Index, | 13 | MergeSubsection.Index, |
| 14 | IndexContext, | 14 | IndexContext, |
| 15 | std.hash_map.default_max_load_percentage, | 15 | std.hash_map.default_max_load_percentage, |
| 16 | ) = .{}, | 16 | ) = .{}, |
| 17 | subsections: std.ArrayListUnmanaged(MergeSubsection) = .{}, | 17 | subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty, |
| 18 | finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, | 18 | finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, |
| 19 | 19 | ||
| 20 | pub fn deinit(msec: *MergeSection, allocator: Allocator) void { | 20 | pub fn deinit(msec: *MergeSection, allocator: Allocator) void { |
| 21 | msec.bytes.deinit(allocator); | 21 | msec.bytes.deinit(allocator); |
| ... | @@ -276,10 +276,10 @@ pub const MergeSubsection = struct { | ... | @@ -276,10 +276,10 @@ pub const MergeSubsection = struct { |
| 276 | pub const InputMergeSection = struct { | 276 | pub const InputMergeSection = struct { |
| 277 | merge_section_index: MergeSection.Index = 0, | 277 | merge_section_index: MergeSection.Index = 0, |
| 278 | atom_index: Atom.Index = 0, | 278 | atom_index: Atom.Index = 0, |
| 279 | offsets: std.ArrayListUnmanaged(u32) = .{}, | 279 | offsets: std.ArrayListUnmanaged(u32) = .empty, |
| 280 | subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, | 280 | subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, |
| 281 | bytes: std.ArrayListUnmanaged(u8) = .{}, | 281 | bytes: std.ArrayListUnmanaged(u8) = .empty, |
| 282 | strings: std.ArrayListUnmanaged(String) = .{}, | 282 | strings: std.ArrayListUnmanaged(String) = .empty, |
| 283 | 283 | ||
| 284 | pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void { | 284 | pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void { |
| 285 | imsec.offsets.deinit(allocator); | 285 | imsec.offsets.deinit(allocator); |
src/link/Elf/synthetic_sections.zig+9-9| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | pub const DynamicSection = struct { | 1 | pub const DynamicSection = struct { |
| 2 | soname: ?u32 = null, | 2 | soname: ?u32 = null, |
| 3 | needed: std.ArrayListUnmanaged(u32) = .{}, | 3 | needed: std.ArrayListUnmanaged(u32) = .empty, |
| 4 | rpath: u32 = 0, | 4 | rpath: u32 = 0, |
| 5 | 5 | ||
| 6 | pub fn deinit(dt: *DynamicSection, allocator: Allocator) void { | 6 | pub fn deinit(dt: *DynamicSection, allocator: Allocator) void { |
| ... | @@ -226,7 +226,7 @@ pub const DynamicSection = struct { | ... | @@ -226,7 +226,7 @@ pub const DynamicSection = struct { |
| 226 | }; | 226 | }; |
| 227 | 227 | ||
| 228 | pub const GotSection = struct { | 228 | pub const GotSection = struct { |
| 229 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 229 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 230 | output_symtab_ctx: Elf.SymtabCtx = .{}, | 230 | output_symtab_ctx: Elf.SymtabCtx = .{}, |
| 231 | tlsld_index: ?u32 = null, | 231 | tlsld_index: ?u32 = null, |
| 232 | flags: Flags = .{}, | 232 | flags: Flags = .{}, |
| ... | @@ -629,7 +629,7 @@ pub const GotSection = struct { | ... | @@ -629,7 +629,7 @@ pub const GotSection = struct { |
| 629 | }; | 629 | }; |
| 630 | 630 | ||
| 631 | pub const PltSection = struct { | 631 | pub const PltSection = struct { |
| 632 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, | 632 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, |
| 633 | output_symtab_ctx: Elf.SymtabCtx = .{}, | 633 | output_symtab_ctx: Elf.SymtabCtx = .{}, |
| 634 | 634 | ||
| 635 | pub fn deinit(plt: *PltSection, allocator: Allocator) void { | 635 | pub fn deinit(plt: *PltSection, allocator: Allocator) void { |
| ... | @@ -883,7 +883,7 @@ pub const GotPltSection = struct { | ... | @@ -883,7 +883,7 @@ pub const GotPltSection = struct { |
| 883 | }; | 883 | }; |
| 884 | 884 | ||
| 885 | pub const PltGotSection = struct { | 885 | pub const PltGotSection = struct { |
| 886 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, | 886 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, |
| 887 | output_symtab_ctx: Elf.SymtabCtx = .{}, | 887 | output_symtab_ctx: Elf.SymtabCtx = .{}, |
| 888 | 888 | ||
| 889 | pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void { | 889 | pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void { |
| ... | @@ -994,7 +994,7 @@ pub const PltGotSection = struct { | ... | @@ -994,7 +994,7 @@ pub const PltGotSection = struct { |
| 994 | }; | 994 | }; |
| 995 | 995 | ||
| 996 | pub const CopyRelSection = struct { | 996 | pub const CopyRelSection = struct { |
| 997 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, | 997 | symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, |
| 998 | 998 | ||
| 999 | pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void { | 999 | pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void { |
| 1000 | copy_rel.symbols.deinit(allocator); | 1000 | copy_rel.symbols.deinit(allocator); |
| ... | @@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct { | ... | @@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct { |
| 1072 | }; | 1072 | }; |
| 1073 | 1073 | ||
| 1074 | pub const DynsymSection = struct { | 1074 | pub const DynsymSection = struct { |
| 1075 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 1075 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 1076 | 1076 | ||
| 1077 | pub const Entry = struct { | 1077 | pub const Entry = struct { |
| 1078 | /// Ref of the symbol which gets privilege of getting a dynamic treatment | 1078 | /// Ref of the symbol which gets privilege of getting a dynamic treatment |
| ... | @@ -1156,7 +1156,7 @@ pub const DynsymSection = struct { | ... | @@ -1156,7 +1156,7 @@ pub const DynsymSection = struct { |
| 1156 | }; | 1156 | }; |
| 1157 | 1157 | ||
| 1158 | pub const HashSection = struct { | 1158 | pub const HashSection = struct { |
| 1159 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 1159 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 1160 | 1160 | ||
| 1161 | pub fn deinit(hs: *HashSection, allocator: Allocator) void { | 1161 | pub fn deinit(hs: *HashSection, allocator: Allocator) void { |
| 1162 | hs.buffer.deinit(allocator); | 1162 | hs.buffer.deinit(allocator); |
| ... | @@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct { | ... | @@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct { |
| 1320 | }; | 1320 | }; |
| 1321 | 1321 | ||
| 1322 | pub const VerneedSection = struct { | 1322 | pub const VerneedSection = struct { |
| 1323 | verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .{}, | 1323 | verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .empty, |
| 1324 | vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .{}, | 1324 | vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .empty, |
| 1325 | index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1, | 1325 | index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1, |
| 1326 | 1326 | ||
| 1327 | pub fn deinit(vern: *VerneedSection, allocator: Allocator) void { | 1327 | pub fn deinit(vern: *VerneedSection, allocator: Allocator) void { |
src/link/MachO.zig+21-21| ... | @@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{}, | ... | @@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{}, |
| 13 | /// Long-lived list of all file descriptors. | 13 | /// Long-lived list of all file descriptors. |
| 14 | /// We store them globally rather than per actual File so that we can re-use | 14 | /// We store them globally rather than per actual File so that we can re-use |
| 15 | /// one file handle per every object file within an archive. | 15 | /// one file handle per every object file within an archive. |
| 16 | file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, | 16 | file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, |
| 17 | zig_object: ?File.Index = null, | 17 | zig_object: ?File.Index = null, |
| 18 | internal_object: ?File.Index = null, | 18 | internal_object: ?File.Index = null, |
| 19 | objects: std.ArrayListUnmanaged(File.Index) = .{}, | 19 | objects: std.ArrayListUnmanaged(File.Index) = .empty, |
| 20 | dylibs: std.ArrayListUnmanaged(File.Index) = .{}, | 20 | dylibs: std.ArrayListUnmanaged(File.Index) = .empty, |
| 21 | 21 | ||
| 22 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, | 22 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, |
| 23 | sections: std.MultiArrayList(Section) = .{}, | 23 | sections: std.MultiArrayList(Section) = .{}, |
| 24 | 24 | ||
| 25 | resolver: SymbolResolver = .{}, | 25 | resolver: SymbolResolver = .{}, |
| 26 | /// This table will be populated after `scanRelocs` has run. | 26 | /// This table will be populated after `scanRelocs` has run. |
| 27 | /// Key is symbol index. | 27 | /// Key is symbol index. |
| 28 | undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{}, | 28 | undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .empty, |
| 29 | undefs_mutex: std.Thread.Mutex = .{}, | 29 | undefs_mutex: std.Thread.Mutex = .{}, |
| 30 | dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{}, | 30 | dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .empty, |
| 31 | dupes_mutex: std.Thread.Mutex = .{}, | 31 | dupes_mutex: std.Thread.Mutex = .{}, |
| 32 | 32 | ||
| 33 | dyld_info_cmd: macho.dyld_info_command = .{}, | 33 | dyld_info_cmd: macho.dyld_info_command = .{}, |
| ... | @@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null, | ... | @@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null, |
| 52 | unwind_info_sect_index: ?u8 = null, | 52 | unwind_info_sect_index: ?u8 = null, |
| 53 | objc_stubs_sect_index: ?u8 = null, | 53 | objc_stubs_sect_index: ?u8 = null, |
| 54 | 54 | ||
| 55 | thunks: std.ArrayListUnmanaged(Thunk) = .{}, | 55 | thunks: std.ArrayListUnmanaged(Thunk) = .empty, |
| 56 | 56 | ||
| 57 | /// Output synthetic sections | 57 | /// Output synthetic sections |
| 58 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, | 58 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, |
| 59 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 59 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 60 | indsymtab: Indsymtab = .{}, | 60 | indsymtab: Indsymtab = .{}, |
| 61 | got: GotSection = .{}, | 61 | got: GotSection = .{}, |
| 62 | stubs: StubsSection = .{}, | 62 | stubs: StubsSection = .{}, |
| ... | @@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main"; | ... | @@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main"; |
| 4041 | const Section = struct { | 4041 | const Section = struct { |
| 4042 | header: macho.section_64, | 4042 | header: macho.section_64, |
| 4043 | segment_id: u8, | 4043 | segment_id: u8, |
| 4044 | atoms: std.ArrayListUnmanaged(Ref) = .{}, | 4044 | atoms: std.ArrayListUnmanaged(Ref) = .empty, |
| 4045 | free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, | 4045 | free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 4046 | last_atom_index: Atom.Index = 0, | 4046 | last_atom_index: Atom.Index = 0, |
| 4047 | thunks: std.ArrayListUnmanaged(Thunk.Index) = .{}, | 4047 | thunks: std.ArrayListUnmanaged(Thunk.Index) = .empty, |
| 4048 | out: std.ArrayListUnmanaged(u8) = .{}, | 4048 | out: std.ArrayListUnmanaged(u8) = .empty, |
| 4049 | relocs: std.ArrayListUnmanaged(macho.relocation_info) = .{}, | 4049 | relocs: std.ArrayListUnmanaged(macho.relocation_info) = .empty, |
| 4050 | }; | 4050 | }; |
| 4051 | 4051 | ||
| 4052 | pub const LiteralPool = struct { | 4052 | pub const LiteralPool = struct { |
| 4053 | table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, | 4053 | table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, |
| 4054 | keys: std.ArrayListUnmanaged(Key) = .{}, | 4054 | keys: std.ArrayListUnmanaged(Key) = .empty, |
| 4055 | values: std.ArrayListUnmanaged(MachO.Ref) = .{}, | 4055 | values: std.ArrayListUnmanaged(MachO.Ref) = .empty, |
| 4056 | data: std.ArrayListUnmanaged(u8) = .{}, | 4056 | data: std.ArrayListUnmanaged(u8) = .empty, |
| 4057 | 4057 | ||
| 4058 | pub fn deinit(lp: *LiteralPool, allocator: Allocator) void { | 4058 | pub fn deinit(lp: *LiteralPool, allocator: Allocator) void { |
| 4059 | lp.table.deinit(allocator); | 4059 | lp.table.deinit(allocator); |
| ... | @@ -4480,9 +4480,9 @@ pub const Ref = struct { | ... | @@ -4480,9 +4480,9 @@ pub const Ref = struct { |
| 4480 | }; | 4480 | }; |
| 4481 | 4481 | ||
| 4482 | pub const SymbolResolver = struct { | 4482 | pub const SymbolResolver = struct { |
| 4483 | keys: std.ArrayListUnmanaged(Key) = .{}, | 4483 | keys: std.ArrayListUnmanaged(Key) = .empty, |
| 4484 | values: std.ArrayListUnmanaged(Ref) = .{}, | 4484 | values: std.ArrayListUnmanaged(Ref) = .empty, |
| 4485 | table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, | 4485 | table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, |
| 4486 | 4486 | ||
| 4487 | const Result = struct { | 4487 | const Result = struct { |
| 4488 | found_existing: bool, | 4488 | found_existing: bool, |
src/link/MachO/Archive.zig+2-2| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | objects: std.ArrayListUnmanaged(Object) = .{}, | 1 | objects: std.ArrayListUnmanaged(Object) = .empty, |
| 2 | 2 | ||
| 3 | pub fn deinit(self: *Archive, allocator: Allocator) void { | 3 | pub fn deinit(self: *Archive, allocator: Allocator) void { |
| 4 | self.objects.deinit(allocator); | 4 | self.objects.deinit(allocator); |
| ... | @@ -181,7 +181,7 @@ pub const ar_hdr = extern struct { | ... | @@ -181,7 +181,7 @@ pub const ar_hdr = extern struct { |
| 181 | }; | 181 | }; |
| 182 | 182 | ||
| 183 | pub const ArSymtab = struct { | 183 | pub const ArSymtab = struct { |
| 184 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 184 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 185 | strtab: StringTable = .{}, | 185 | strtab: StringTable = .{}, |
| 186 | 186 | ||
| 187 | pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { | 187 | pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { |
src/link/MachO/CodeSignature.zig+1-1| ... | @@ -53,7 +53,7 @@ const CodeDirectory = struct { | ... | @@ -53,7 +53,7 @@ const CodeDirectory = struct { |
| 53 | inner: macho.CodeDirectory, | 53 | inner: macho.CodeDirectory, |
| 54 | ident: []const u8, | 54 | ident: []const u8, |
| 55 | special_slots: [n_special_slots][hash_size]u8, | 55 | 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, |
| 57 | 57 | ||
| 58 | const n_special_slots: usize = 7; | 58 | const n_special_slots: usize = 7; |
| 59 | 59 |
src/link/MachO/DebugSymbols.zig+5-5| ... | @@ -4,8 +4,8 @@ file: fs.File, | ... | @@ -4,8 +4,8 @@ file: fs.File, |
| 4 | symtab_cmd: macho.symtab_command = .{}, | 4 | symtab_cmd: macho.symtab_command = .{}, |
| 5 | uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 }, | 5 | uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 }, |
| 6 | 6 | ||
| 7 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, | 7 | segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, |
| 8 | sections: std.ArrayListUnmanaged(macho.section_64) = .{}, | 8 | sections: std.ArrayListUnmanaged(macho.section_64) = .empty, |
| 9 | 9 | ||
| 10 | dwarf_segment_cmd_index: ?u8 = null, | 10 | dwarf_segment_cmd_index: ?u8 = null, |
| 11 | linkedit_segment_cmd_index: ?u8 = null, | 11 | linkedit_segment_cmd_index: ?u8 = null, |
| ... | @@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null, | ... | @@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null, |
| 19 | debug_loclists_section_index: ?u8 = null, | 19 | debug_loclists_section_index: ?u8 = null, |
| 20 | debug_rnglists_section_index: ?u8 = null, | 20 | debug_rnglists_section_index: ?u8 = null, |
| 21 | 21 | ||
| 22 | relocs: std.ArrayListUnmanaged(Reloc) = .{}, | 22 | relocs: std.ArrayListUnmanaged(Reloc) = .empty, |
| 23 | 23 | ||
| 24 | /// Output synthetic sections | 24 | /// Output synthetic sections |
| 25 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, | 25 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, |
| 26 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 26 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 27 | 27 | ||
| 28 | pub const Reloc = struct { | 28 | pub const Reloc = struct { |
| 29 | type: enum { | 29 | type: enum { |
src/link/MachO/Dylib.zig+7-7| ... | @@ -6,15 +6,15 @@ file_handle: File.HandleIndex, | ... | @@ -6,15 +6,15 @@ file_handle: File.HandleIndex, |
| 6 | tag: enum { dylib, tbd }, | 6 | tag: enum { dylib, tbd }, |
| 7 | 7 | ||
| 8 | exports: std.MultiArrayList(Export) = .{}, | 8 | exports: std.MultiArrayList(Export) = .{}, |
| 9 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 9 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 10 | id: ?Id = null, | 10 | id: ?Id = null, |
| 11 | ordinal: u16 = 0, | 11 | ordinal: u16 = 0, |
| 12 | 12 | ||
| 13 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 13 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 14 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 15 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, | 15 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, |
| 16 | dependents: std.ArrayListUnmanaged(Id) = .{}, | 16 | dependents: std.ArrayListUnmanaged(Id) = .empty, |
| 17 | rpaths: std.StringArrayHashMapUnmanaged(void) = .{}, | 17 | rpaths: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 18 | umbrella: File.Index, | 18 | umbrella: File.Index, |
| 19 | platform: ?MachO.Platform = null, | 19 | platform: ?MachO.Platform = null, |
| 20 | 20 | ||
| ... | @@ -742,7 +742,7 @@ pub const TargetMatcher = struct { | ... | @@ -742,7 +742,7 @@ pub const TargetMatcher = struct { |
| 742 | allocator: Allocator, | 742 | allocator: Allocator, |
| 743 | cpu_arch: std.Target.Cpu.Arch, | 743 | cpu_arch: std.Target.Cpu.Arch, |
| 744 | platform: macho.PLATFORM, | 744 | platform: macho.PLATFORM, |
| 745 | target_strings: std.ArrayListUnmanaged([]const u8) = .{}, | 745 | target_strings: std.ArrayListUnmanaged([]const u8) = .empty, |
| 746 | 746 | ||
| 747 | pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher { | 747 | pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher { |
| 748 | var self = TargetMatcher{ | 748 | var self = TargetMatcher{ |
src/link/MachO/InternalObject.zig+13-13| ... | @@ -1,19 +1,19 @@ | ... | @@ -1,19 +1,19 @@ |
| 1 | index: File.Index, | 1 | index: File.Index, |
| 2 | 2 | ||
| 3 | sections: std.MultiArrayList(Section) = .{}, | 3 | sections: std.MultiArrayList(Section) = .{}, |
| 4 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 4 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 5 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, | 5 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 6 | atoms_extra: std.ArrayListUnmanaged(u32) = .{}, | 6 | atoms_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 7 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, | 7 | symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, |
| 8 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 8 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 9 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 9 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 10 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 10 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 11 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, | 11 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, |
| 12 | 12 | ||
| 13 | objc_methnames: std.ArrayListUnmanaged(u8) = .{}, | 13 | objc_methnames: std.ArrayListUnmanaged(u8) = .empty, |
| 14 | objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64), | 14 | objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64), |
| 15 | 15 | ||
| 16 | force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 16 | force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 17 | entry_index: ?Symbol.Index = null, | 17 | entry_index: ?Symbol.Index = null, |
| 18 | dyld_stub_binder_index: ?Symbol.Index = null, | 18 | dyld_stub_binder_index: ?Symbol.Index = null, |
| 19 | dyld_private_index: ?Symbol.Index = null, | 19 | dyld_private_index: ?Symbol.Index = null, |
| ... | @@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null, | ... | @@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null, |
| 21 | mh_execute_header_index: ?Symbol.Index = null, | 21 | mh_execute_header_index: ?Symbol.Index = null, |
| 22 | mh_dylib_header_index: ?Symbol.Index = null, | 22 | mh_dylib_header_index: ?Symbol.Index = null, |
| 23 | dso_handle_index: ?Symbol.Index = null, | 23 | dso_handle_index: ?Symbol.Index = null, |
| 24 | boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 24 | boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 25 | 25 | ||
| 26 | output_symtab_ctx: MachO.SymtabCtx = .{}, | 26 | output_symtab_ctx: MachO.SymtabCtx = .{}, |
| 27 | 27 | ||
| ... | @@ -849,7 +849,7 @@ fn formatSymtab( | ... | @@ -849,7 +849,7 @@ fn formatSymtab( |
| 849 | 849 | ||
| 850 | const Section = struct { | 850 | const Section = struct { |
| 851 | header: macho.section_64, | 851 | header: macho.section_64, |
| 852 | relocs: std.ArrayListUnmanaged(Relocation) = .{}, | 852 | relocs: std.ArrayListUnmanaged(Relocation) = .empty, |
| 853 | extra: Extra = .{}, | 853 | extra: Extra = .{}, |
| 854 | 854 | ||
| 855 | const Extra = packed struct { | 855 | const Extra = packed struct { |
src/link/MachO/Object.zig+17-17| ... | @@ -9,27 +9,27 @@ in_archive: ?InArchive = null, | ... | @@ -9,27 +9,27 @@ in_archive: ?InArchive = null, |
| 9 | header: ?macho.mach_header_64 = null, | 9 | header: ?macho.mach_header_64 = null, |
| 10 | sections: std.MultiArrayList(Section) = .{}, | 10 | sections: std.MultiArrayList(Section) = .{}, |
| 11 | symtab: std.MultiArrayList(Nlist) = .{}, | 11 | symtab: std.MultiArrayList(Nlist) = .{}, |
| 12 | strtab: std.ArrayListUnmanaged(u8) = .{}, | 12 | strtab: std.ArrayListUnmanaged(u8) = .empty, |
| 13 | 13 | ||
| 14 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 14 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 15 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 15 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 16 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, | 16 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, |
| 17 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 17 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 18 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, | 18 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 19 | atoms_extra: std.ArrayListUnmanaged(u32) = .{}, | 19 | atoms_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 20 | 20 | ||
| 21 | platform: ?MachO.Platform = null, | 21 | platform: ?MachO.Platform = null, |
| 22 | compile_unit: ?CompileUnit = null, | 22 | compile_unit: ?CompileUnit = null, |
| 23 | stab_files: std.ArrayListUnmanaged(StabFile) = .{}, | 23 | stab_files: std.ArrayListUnmanaged(StabFile) = .empty, |
| 24 | 24 | ||
| 25 | eh_frame_sect_index: ?u8 = null, | 25 | eh_frame_sect_index: ?u8 = null, |
| 26 | compact_unwind_sect_index: ?u8 = null, | 26 | compact_unwind_sect_index: ?u8 = null, |
| 27 | cies: std.ArrayListUnmanaged(Cie) = .{}, | 27 | cies: std.ArrayListUnmanaged(Cie) = .empty, |
| 28 | fdes: std.ArrayListUnmanaged(Fde) = .{}, | 28 | fdes: std.ArrayListUnmanaged(Fde) = .empty, |
| 29 | eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, | 29 | eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, |
| 30 | unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .{}, | 30 | unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .empty, |
| 31 | unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .{}, | 31 | unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .empty, |
| 32 | data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .{}, | 32 | data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .empty, |
| 33 | 33 | ||
| 34 | alive: bool = true, | 34 | alive: bool = true, |
| 35 | hidden: bool = false, | 35 | hidden: bool = false, |
| ... | @@ -2675,8 +2675,8 @@ fn formatPath( | ... | @@ -2675,8 +2675,8 @@ fn formatPath( |
| 2675 | 2675 | ||
| 2676 | const Section = struct { | 2676 | const Section = struct { |
| 2677 | header: macho.section_64, | 2677 | header: macho.section_64, |
| 2678 | subsections: std.ArrayListUnmanaged(Subsection) = .{}, | 2678 | subsections: std.ArrayListUnmanaged(Subsection) = .empty, |
| 2679 | relocs: std.ArrayListUnmanaged(Relocation) = .{}, | 2679 | relocs: std.ArrayListUnmanaged(Relocation) = .empty, |
| 2680 | }; | 2680 | }; |
| 2681 | 2681 | ||
| 2682 | const Subsection = struct { | 2682 | const Subsection = struct { |
| ... | @@ -2692,7 +2692,7 @@ pub const Nlist = struct { | ... | @@ -2692,7 +2692,7 @@ pub const Nlist = struct { |
| 2692 | 2692 | ||
| 2693 | const StabFile = struct { | 2693 | const StabFile = struct { |
| 2694 | comp_dir: u32, | 2694 | comp_dir: u32, |
| 2695 | stabs: std.ArrayListUnmanaged(Stab) = .{}, | 2695 | stabs: std.ArrayListUnmanaged(Stab) = .empty, |
| 2696 | 2696 | ||
| 2697 | fn getCompDir(sf: StabFile, object: Object) [:0]const u8 { | 2697 | fn getCompDir(sf: StabFile, object: Object) [:0]const u8 { |
| 2698 | const nlist = object.symtab.items(.nlist)[sf.comp_dir]; | 2698 | const nlist = object.symtab.items(.nlist)[sf.comp_dir]; |
src/link/MachO/Thunk.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | value: u64 = 0, | 1 | value: u64 = 0, |
| 2 | out_n_sect: u8 = 0, | 2 | out_n_sect: u8 = 0, |
| 3 | symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .{}, | 3 | symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty, |
| 4 | output_symtab_ctx: MachO.SymtabCtx = .{}, | 4 | output_symtab_ctx: MachO.SymtabCtx = .{}, |
| 5 | 5 | ||
| 6 | pub fn deinit(thunk: *Thunk, allocator: Allocator) void { | 6 | pub fn deinit(thunk: *Thunk, allocator: Allocator) void { |
src/link/MachO/UnwindInfo.zig+4-4| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | /// List of all unwind records gathered from all objects and sorted | 1 | /// List of all unwind records gathered from all objects and sorted |
| 2 | /// by allocated relative function address within the section. | 2 | /// by allocated relative function address within the section. |
| 3 | records: std.ArrayListUnmanaged(Record.Ref) = .{}, | 3 | records: std.ArrayListUnmanaged(Record.Ref) = .empty, |
| 4 | 4 | ||
| 5 | /// List of all personalities referenced by either unwind info entries | 5 | /// List of all personalities referenced by either unwind info entries |
| 6 | /// or __eh_frame entries. | 6 | /// or __eh_frame entries. |
| ... | @@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined, | ... | @@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined, |
| 12 | common_encodings_count: u7 = 0, | 12 | common_encodings_count: u7 = 0, |
| 13 | 13 | ||
| 14 | /// List of record indexes containing an LSDA pointer. | 14 | /// List of record indexes containing an LSDA pointer. |
| 15 | lsdas: std.ArrayListUnmanaged(u32) = .{}, | 15 | lsdas: std.ArrayListUnmanaged(u32) = .empty, |
| 16 | lsdas_lookup: std.ArrayListUnmanaged(u32) = .{}, | 16 | lsdas_lookup: std.ArrayListUnmanaged(u32) = .empty, |
| 17 | 17 | ||
| 18 | /// List of second level pages. | 18 | /// List of second level pages. |
| 19 | pages: std.ArrayListUnmanaged(Page) = .{}, | 19 | pages: std.ArrayListUnmanaged(Page) = .empty, |
| 20 | 20 | ||
| 21 | pub fn deinit(info: *UnwindInfo, allocator: Allocator) void { | 21 | pub fn deinit(info: *UnwindInfo, allocator: Allocator) void { |
| 22 | info.records.deinit(allocator); | 22 | info.records.deinit(allocator); |
src/link/MachO/ZigObject.zig+9-9| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | data: std.ArrayListUnmanaged(u8) = .{}, | 1 | data: std.ArrayListUnmanaged(u8) = .empty, |
| 2 | /// Externally owned memory. | 2 | /// Externally owned memory. |
| 3 | path: []const u8, | 3 | path: []const u8, |
| 4 | index: File.Index, | 4 | index: File.Index, |
| ... | @@ -6,15 +6,15 @@ index: File.Index, | ... | @@ -6,15 +6,15 @@ index: File.Index, |
| 6 | symtab: std.MultiArrayList(Nlist) = .{}, | 6 | symtab: std.MultiArrayList(Nlist) = .{}, |
| 7 | strtab: StringTable = .{}, | 7 | strtab: StringTable = .{}, |
| 8 | 8 | ||
| 9 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 9 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 10 | symbols_extra: std.ArrayListUnmanaged(u32) = .{}, | 10 | symbols_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 11 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, | 11 | globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, |
| 12 | /// Maps string index (so name) into nlist index for the global symbol defined within this | 12 | /// Maps string index (so name) into nlist index for the global symbol defined within this |
| 13 | /// module. | 13 | /// module. |
| 14 | globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .{}, | 14 | globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .empty, |
| 15 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 15 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 16 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, | 16 | atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 17 | atoms_extra: std.ArrayListUnmanaged(u32) = .{}, | 17 | atoms_extra: std.ArrayListUnmanaged(u32) = .empty, |
| 18 | 18 | ||
| 19 | /// Table of tracked LazySymbols. | 19 | /// Table of tracked LazySymbols. |
| 20 | lazy_syms: LazySymbolTable = .{}, | 20 | lazy_syms: LazySymbolTable = .{}, |
| ... | @@ -1786,7 +1786,7 @@ fn formatAtoms( | ... | @@ -1786,7 +1786,7 @@ fn formatAtoms( |
| 1786 | const AvMetadata = struct { | 1786 | const AvMetadata = struct { |
| 1787 | symbol_index: Symbol.Index, | 1787 | symbol_index: Symbol.Index, |
| 1788 | /// A list of all exports aliases of this Av. | 1788 | /// A list of all exports aliases of this Av. |
| 1789 | exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 1789 | exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 1790 | 1790 | ||
| 1791 | fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 { | 1791 | fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 { |
| 1792 | for (m.exports.items) |*exp| { | 1792 | for (m.exports.items) |*exp| { |
src/link/MachO/dyld_info/Rebase.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 1 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 2 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 2 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 3 | 3 | ||
| 4 | pub const Entry = struct { | 4 | pub const Entry = struct { |
| 5 | offset: u64, | 5 | offset: u64, |
src/link/MachO/dyld_info/Trie.zig+3-3| ... | @@ -31,9 +31,9 @@ | ... | @@ -31,9 +31,9 @@ |
| 31 | 31 | ||
| 32 | /// The root node of the trie. | 32 | /// The root node of the trie. |
| 33 | root: ?Node.Index = null, | 33 | root: ?Node.Index = null, |
| 34 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 34 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 35 | nodes: std.MultiArrayList(Node) = .{}, | 35 | nodes: std.MultiArrayList(Node) = .{}, |
| 36 | edges: std.ArrayListUnmanaged(Edge) = .{}, | 36 | edges: std.ArrayListUnmanaged(Edge) = .empty, |
| 37 | 37 | ||
| 38 | /// Insert a symbol into the trie, updating the prefixes in the process. | 38 | /// Insert a symbol into the trie, updating the prefixes in the process. |
| 39 | /// This operation may change the layout of the trie by splicing edges in | 39 | /// This operation may change the layout of the trie by splicing edges in |
| ... | @@ -317,7 +317,7 @@ const Node = struct { | ... | @@ -317,7 +317,7 @@ const Node = struct { |
| 317 | trie_offset: u32 = 0, | 317 | trie_offset: u32 = 0, |
| 318 | 318 | ||
| 319 | /// List of all edges originating from this node. | 319 | /// List of all edges originating from this node. |
| 320 | edges: std.ArrayListUnmanaged(Edge.Index) = .{}, | 320 | edges: std.ArrayListUnmanaged(Edge.Index) = .empty, |
| 321 | 321 | ||
| 322 | const Index = u32; | 322 | const Index = u32; |
| 323 | }; | 323 | }; |
src/link/MachO/dyld_info/bind.zig+7-7| ... | @@ -17,8 +17,8 @@ pub const Entry = struct { | ... | @@ -17,8 +17,8 @@ pub const Entry = struct { |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | pub const Bind = struct { | 19 | pub const Bind = struct { |
| 20 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 20 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 21 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 21 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 22 | 22 | ||
| 23 | const Self = @This(); | 23 | const Self = @This(); |
| 24 | 24 | ||
| ... | @@ -269,8 +269,8 @@ pub const Bind = struct { | ... | @@ -269,8 +269,8 @@ pub const Bind = struct { |
| 269 | }; | 269 | }; |
| 270 | 270 | ||
| 271 | pub const WeakBind = struct { | 271 | pub const WeakBind = struct { |
| 272 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 272 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 273 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 273 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 274 | 274 | ||
| 275 | const Self = @This(); | 275 | const Self = @This(); |
| 276 | 276 | ||
| ... | @@ -511,9 +511,9 @@ pub const WeakBind = struct { | ... | @@ -511,9 +511,9 @@ pub const WeakBind = struct { |
| 511 | }; | 511 | }; |
| 512 | 512 | ||
| 513 | pub const LazyBind = struct { | 513 | pub const LazyBind = struct { |
| 514 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 514 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 515 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 515 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 516 | offsets: std.ArrayListUnmanaged(u32) = .{}, | 516 | offsets: std.ArrayListUnmanaged(u32) = .empty, |
| 517 | 517 | ||
| 518 | const Self = @This(); | 518 | const Self = @This(); |
| 519 | 519 |
src/link/MachO/synthetic.zig+5-5| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | pub const GotSection = struct { | 1 | pub const GotSection = struct { |
| 2 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, | 2 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, |
| 3 | 3 | ||
| 4 | pub const Index = u32; | 4 | pub const Index = u32; |
| 5 | 5 | ||
| ... | @@ -68,7 +68,7 @@ pub const GotSection = struct { | ... | @@ -68,7 +68,7 @@ pub const GotSection = struct { |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | pub const StubsSection = struct { | 70 | pub const StubsSection = struct { |
| 71 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, | 71 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, |
| 72 | 72 | ||
| 73 | pub const Index = u32; | 73 | pub const Index = u32; |
| 74 | 74 | ||
| ... | @@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct { | ... | @@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct { |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | pub const TlvPtrSection = struct { | 318 | pub const TlvPtrSection = struct { |
| 319 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, | 319 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, |
| 320 | 320 | ||
| 321 | pub const Index = u32; | 321 | pub const Index = u32; |
| 322 | 322 | ||
| ... | @@ -388,7 +388,7 @@ pub const TlvPtrSection = struct { | ... | @@ -388,7 +388,7 @@ pub const TlvPtrSection = struct { |
| 388 | }; | 388 | }; |
| 389 | 389 | ||
| 390 | pub const ObjcStubsSection = struct { | 390 | pub const ObjcStubsSection = struct { |
| 391 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, | 391 | symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, |
| 392 | 392 | ||
| 393 | pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void { | 393 | pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void { |
| 394 | objc.symbols.deinit(allocator); | 394 | objc.symbols.deinit(allocator); |
| ... | @@ -548,7 +548,7 @@ pub const Indsymtab = struct { | ... | @@ -548,7 +548,7 @@ pub const Indsymtab = struct { |
| 548 | }; | 548 | }; |
| 549 | 549 | ||
| 550 | pub const DataInCode = struct { | 550 | pub const DataInCode = struct { |
| 551 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 551 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 552 | 552 | ||
| 553 | pub fn deinit(dice: *DataInCode, allocator: Allocator) void { | 553 | pub fn deinit(dice: *DataInCode, allocator: Allocator) void { |
| 554 | dice.entries.deinit(allocator); | 554 | dice.entries.deinit(allocator); |
src/link/Plan9.zig+12-12| ... | @@ -34,13 +34,13 @@ bases: Bases, | ... | @@ -34,13 +34,13 @@ bases: Bases, |
| 34 | /// Does not represent the order or amount of symbols in the file | 34 | /// Does not represent the order or amount of symbols in the file |
| 35 | /// it is just useful for storing symbols. Some other symbols are in | 35 | /// it is just useful for storing symbols. Some other symbols are in |
| 36 | /// file_segments. | 36 | /// file_segments. |
| 37 | syms: std.ArrayListUnmanaged(aout.Sym) = .{}, | 37 | syms: std.ArrayListUnmanaged(aout.Sym) = .empty, |
| 38 | 38 | ||
| 39 | /// The plan9 a.out format requires segments of | 39 | /// The plan9 a.out format requires segments of |
| 40 | /// filenames to be deduplicated, so we use this map to | 40 | /// filenames to be deduplicated, so we use this map to |
| 41 | /// de duplicate it. The value is the value of the path | 41 | /// de duplicate it. The value is the value of the path |
| 42 | /// component | 42 | /// component |
| 43 | file_segments: std.StringArrayHashMapUnmanaged(u16) = .{}, | 43 | file_segments: std.StringArrayHashMapUnmanaged(u16) = .empty, |
| 44 | /// The value of a 'f' symbol increments by 1 every time, so that no 2 'f' | 44 | /// The value of a 'f' symbol increments by 1 every time, so that no 2 'f' |
| 45 | /// symbols have the same value. | 45 | /// symbols have the same value. |
| 46 | file_segments_i: u16 = 1, | 46 | file_segments_i: u16 = 1, |
| ... | @@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator, | ... | @@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator, |
| 54 | /// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place) | 54 | /// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place) |
| 55 | fn_nav_table: std.AutoArrayHashMapUnmanaged( | 55 | fn_nav_table: std.AutoArrayHashMapUnmanaged( |
| 56 | Zcu.File.Index, | 56 | 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 }, |
| 58 | ) = .{}, | 58 | ) = .{}, |
| 59 | /// the code is modified when relocated, so that is why it is mutable | 59 | /// the code is modified when relocated, so that is why it is mutable |
| 60 | data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .{}, | 60 | data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .empty, |
| 61 | /// When `updateExports` is called, we store the export indices here, to be used | 61 | /// When `updateExports` is called, we store the export indices here, to be used |
| 62 | /// during flush. | 62 | /// during flush. |
| 63 | nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .{}, | 63 | nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .empty, |
| 64 | 64 | ||
| 65 | lazy_syms: LazySymbolTable = .{}, | 65 | lazy_syms: LazySymbolTable = .{}, |
| 66 | 66 | ||
| 67 | uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, | 67 | uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, |
| 68 | 68 | ||
| 69 | relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .{}, | 69 | relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .empty, |
| 70 | hdr: aout.ExecHdr = undefined, | 70 | hdr: aout.ExecHdr = undefined, |
| 71 | 71 | ||
| 72 | // relocs: std. | 72 | // relocs: std. |
| ... | @@ -77,12 +77,12 @@ entry_val: ?u64 = null, | ... | @@ -77,12 +77,12 @@ entry_val: ?u64 = null, |
| 77 | got_len: usize = 0, | 77 | got_len: usize = 0, |
| 78 | // A list of all the free got indexes, so when making a new decl | 78 | // A list of all the free got indexes, so when making a new decl |
| 79 | // don't make a new one, just use one from here. | 79 | // don't make a new one, just use one from here. |
| 80 | got_index_free_list: std.ArrayListUnmanaged(usize) = .{}, | 80 | got_index_free_list: std.ArrayListUnmanaged(usize) = .empty, |
| 81 | 81 | ||
| 82 | syms_index_free_list: std.ArrayListUnmanaged(usize) = .{}, | 82 | syms_index_free_list: std.ArrayListUnmanaged(usize) = .empty, |
| 83 | 83 | ||
| 84 | atoms: std.ArrayListUnmanaged(Atom) = .{}, | 84 | atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 85 | navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .{}, | 85 | navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .empty, |
| 86 | 86 | ||
| 87 | /// Indices of the three "special" symbols into atoms | 87 | /// Indices of the three "special" symbols into atoms |
| 88 | etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null }, | 88 | etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null }, |
| ... | @@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct { | ... | @@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct { |
| 220 | 220 | ||
| 221 | const NavMetadata = struct { | 221 | const NavMetadata = struct { |
| 222 | index: Atom.Index, | 222 | index: Atom.Index, |
| 223 | exports: std.ArrayListUnmanaged(usize) = .{}, | 223 | exports: std.ArrayListUnmanaged(usize) = .empty, |
| 224 | 224 | ||
| 225 | fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize { | 225 | fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize { |
| 226 | for (m.exports.items) |exp| { | 226 | for (m.exports.items) |exp| { |
src/link/SpirV/BinaryModule.zig+1-1| ... | @@ -148,7 +148,7 @@ pub const Parser = struct { | ... | @@ -148,7 +148,7 @@ pub const Parser = struct { |
| 148 | a: Allocator, | 148 | a: Allocator, |
| 149 | 149 | ||
| 150 | /// Maps (instruction set, opcode) => instruction index (for instruction set) | 150 | /// Maps (instruction set, opcode) => instruction index (for instruction set) |
| 151 | opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .{}, | 151 | opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty, |
| 152 | 152 | ||
| 153 | pub fn init(a: Allocator) !Parser { | 153 | pub fn init(a: Allocator) !Parser { |
| 154 | var self = Parser{ | 154 | var self = Parser{ |
src/link/SpirV/deduplicate.zig+2-2| ... | @@ -178,8 +178,8 @@ const ModuleInfo = struct { | ... | @@ -178,8 +178,8 @@ const ModuleInfo = struct { |
| 178 | 178 | ||
| 179 | const EntityContext = struct { | 179 | const EntityContext = struct { |
| 180 | a: Allocator, | 180 | a: Allocator, |
| 181 | ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, | 181 | ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, |
| 182 | ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, | 182 | ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, |
| 183 | info: *const ModuleInfo, | 183 | info: *const ModuleInfo, |
| 184 | binary: *const BinaryModule, | 184 | binary: *const BinaryModule, |
| 185 | 185 |
src/link/SpirV/lower_invocation_globals.zig+2-2| ... | @@ -342,9 +342,9 @@ const ModuleBuilder = struct { | ... | @@ -342,9 +342,9 @@ const ModuleBuilder = struct { |
| 342 | entry_point_new_id_base: u32, | 342 | entry_point_new_id_base: u32, |
| 343 | /// A set of all function types in the new program. SPIR-V mandates that these are unique, | 343 | /// A set of all function types in the new program. SPIR-V mandates that these are unique, |
| 344 | /// and until a general type deduplication pass is programmed, we just handle it here via this. | 344 | /// 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, |
| 346 | /// Maps functions to new information required for creating the module | 346 | /// 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, |
| 348 | /// Offset of the functions section in the new binary. | 348 | /// Offset of the functions section in the new binary. |
| 349 | new_functions_section: ?usize, | 349 | new_functions_section: ?usize, |
| 350 | 350 |
src/link/StringTable.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | buffer: std.ArrayListUnmanaged(u8) = .{}, | 1 | buffer: std.ArrayListUnmanaged(u8) = .empty, |
| 2 | table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, | 2 | table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, |
| 3 | 3 | ||
| 4 | pub fn deinit(self: *Self, gpa: Allocator) void { | 4 | pub fn deinit(self: *Self, gpa: Allocator) void { |
| 5 | self.buffer.deinit(gpa); | 5 | self.buffer.deinit(gpa); |
src/link/Wasm.zig+23-23| ... | @@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{}, | ... | @@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{}, |
| 72 | /// TODO: Allow setting this through a flag? | 72 | /// TODO: Allow setting this through a flag? |
| 73 | host_name: []const u8 = "env", | 73 | host_name: []const u8 = "env", |
| 74 | /// List of symbols generated by the linker. | 74 | /// List of symbols generated by the linker. |
| 75 | synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 75 | synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 76 | /// Maps atoms to their segment index | 76 | /// Maps atoms to their segment index |
| 77 | atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, | 77 | atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, |
| 78 | /// List of all atoms. | 78 | /// List of all atoms. |
| 79 | managed_atoms: std.ArrayListUnmanaged(Atom) = .{}, | 79 | managed_atoms: std.ArrayListUnmanaged(Atom) = .empty, |
| 80 | /// Represents the index into `segments` where the 'code' section | 80 | /// Represents the index into `segments` where the 'code' section |
| 81 | /// lives. | 81 | /// lives. |
| 82 | code_section_index: ?u32 = null, | 82 | code_section_index: ?u32 = null, |
| ... | @@ -106,22 +106,22 @@ imported_globals_count: u32 = 0, | ... | @@ -106,22 +106,22 @@ imported_globals_count: u32 = 0, |
| 106 | /// to the table indexes when sections are merged. | 106 | /// to the table indexes when sections are merged. |
| 107 | imported_tables_count: u32 = 0, | 107 | imported_tables_count: u32 = 0, |
| 108 | /// Map of symbol locations, represented by its `types.Import` | 108 | /// Map of symbol locations, represented by its `types.Import` |
| 109 | imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .{}, | 109 | imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .empty, |
| 110 | /// Represents non-synthetic section entries. | 110 | /// Represents non-synthetic section entries. |
| 111 | /// Used for code, data and custom sections. | 111 | /// Used for code, data and custom sections. |
| 112 | segments: std.ArrayListUnmanaged(Segment) = .{}, | 112 | segments: std.ArrayListUnmanaged(Segment) = .empty, |
| 113 | /// Maps a data segment key (such as .rodata) to the index into `segments`. | 113 | /// Maps a data segment key (such as .rodata) to the index into `segments`. |
| 114 | data_segments: std.StringArrayHashMapUnmanaged(u32) = .{}, | 114 | data_segments: std.StringArrayHashMapUnmanaged(u32) = .empty, |
| 115 | /// A table of `types.Segment` which provide meta data | 115 | /// A table of `types.Segment` which provide meta data |
| 116 | /// about a data symbol such as its name where the key is | 116 | /// about a data symbol such as its name where the key is |
| 117 | /// the segment index, which can be found from `data_segments` | 117 | /// the segment index, which can be found from `data_segments` |
| 118 | segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .{}, | 118 | segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .empty, |
| 119 | /// Deduplicated string table for strings used by symbols, imports and exports. | 119 | /// Deduplicated string table for strings used by symbols, imports and exports. |
| 120 | string_table: StringTable = .{}, | 120 | string_table: StringTable = .{}, |
| 121 | 121 | ||
| 122 | // Output sections | 122 | // Output sections |
| 123 | /// Output type section | 123 | /// Output type section |
| 124 | func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, | 124 | func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, |
| 125 | /// Output function section where the key is the original | 125 | /// Output function section where the key is the original |
| 126 | /// function index and the value is function. | 126 | /// function index and the value is function. |
| 127 | /// This allows us to map multiple symbols to the same function. | 127 | /// This allows us to map multiple symbols to the same function. |
| ... | @@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged( | ... | @@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged( |
| 130 | struct { func: std.wasm.Func, sym_index: Symbol.Index }, | 130 | struct { func: std.wasm.Func, sym_index: Symbol.Index }, |
| 131 | ) = .{}, | 131 | ) = .{}, |
| 132 | /// Output global section | 132 | /// Output global section |
| 133 | wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, | 133 | wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, |
| 134 | /// Memory section | 134 | /// Memory section |
| 135 | memories: std.wasm.Memory = .{ .limits = .{ | 135 | memories: std.wasm.Memory = .{ .limits = .{ |
| 136 | .min = 0, | 136 | .min = 0, |
| ... | @@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{ | ... | @@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{ |
| 138 | .flags = 0, | 138 | .flags = 0, |
| 139 | } }, | 139 | } }, |
| 140 | /// Output table section | 140 | /// Output table section |
| 141 | tables: std.ArrayListUnmanaged(std.wasm.Table) = .{}, | 141 | tables: std.ArrayListUnmanaged(std.wasm.Table) = .empty, |
| 142 | /// Output export section | 142 | /// Output export section |
| 143 | exports: std.ArrayListUnmanaged(types.Export) = .{}, | 143 | exports: std.ArrayListUnmanaged(types.Export) = .empty, |
| 144 | /// List of initialization functions. These must be called in order of priority | 144 | /// List of initialization functions. These must be called in order of priority |
| 145 | /// by the (synthetic) __wasm_call_ctors function. | 145 | /// by the (synthetic) __wasm_call_ctors function. |
| 146 | init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .{}, | 146 | init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .empty, |
| 147 | /// Index to a function defining the entry of the wasm file | 147 | /// Index to a function defining the entry of the wasm file |
| 148 | entry: ?u32 = null, | 148 | entry: ?u32 = null, |
| 149 | 149 | ||
| ... | @@ -152,31 +152,31 @@ entry: ?u32 = null, | ... | @@ -152,31 +152,31 @@ entry: ?u32 = null, |
| 152 | /// as well as an 'elements' section. | 152 | /// as well as an 'elements' section. |
| 153 | /// | 153 | /// |
| 154 | /// Note: Key is symbol location, value represents the index into the table | 154 | /// Note: Key is symbol location, value represents the index into the table |
| 155 | function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .{}, | 155 | function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .empty, |
| 156 | 156 | ||
| 157 | /// All object files and their data which are linked into the final binary | 157 | /// All object files and their data which are linked into the final binary |
| 158 | objects: std.ArrayListUnmanaged(File.Index) = .{}, | 158 | objects: std.ArrayListUnmanaged(File.Index) = .empty, |
| 159 | /// All archive files that are lazy loaded. | 159 | /// All archive files that are lazy loaded. |
| 160 | /// e.g. when an undefined symbol references a symbol from the archive. | 160 | /// e.g. when an undefined symbol references a symbol from the archive. |
| 161 | archives: std.ArrayListUnmanaged(Archive) = .{}, | 161 | archives: std.ArrayListUnmanaged(Archive) = .empty, |
| 162 | 162 | ||
| 163 | /// A map of global names (read: offset into string table) to their symbol location | 163 | /// A map of global names (read: offset into string table) to their symbol location |
| 164 | globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .{}, | 164 | globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .empty, |
| 165 | /// The list of GOT symbols and their location | 165 | /// The list of GOT symbols and their location |
| 166 | got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .{}, | 166 | got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .empty, |
| 167 | /// Maps discarded symbols and their positions to the location of the symbol | 167 | /// Maps discarded symbols and their positions to the location of the symbol |
| 168 | /// it was resolved to | 168 | /// it was resolved to |
| 169 | discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .{}, | 169 | discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .empty, |
| 170 | /// List of all symbol locations which have been resolved by the linker and will be emit | 170 | /// List of all symbol locations which have been resolved by the linker and will be emit |
| 171 | /// into the final binary. | 171 | /// into the final binary. |
| 172 | resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .{}, | 172 | resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .empty, |
| 173 | /// Symbols that remain undefined after symbol resolution. | 173 | /// Symbols that remain undefined after symbol resolution. |
| 174 | /// Note: The key represents an offset into the string table, rather than the actual string. | 174 | /// Note: The key represents an offset into the string table, rather than the actual string. |
| 175 | undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .{}, | 175 | undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .empty, |
| 176 | /// Maps a symbol's location to an atom. This can be used to find meta | 176 | /// Maps a symbol's location to an atom. This can be used to find meta |
| 177 | /// data of a symbol, such as its size, or its offset to perform a relocation. | 177 | /// data of a symbol, such as its size, or its offset to perform a relocation. |
| 178 | /// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped. | 178 | /// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped. |
| 179 | symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .{}, | 179 | symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .empty, |
| 180 | 180 | ||
| 181 | pub const Alignment = types.Alignment; | 181 | pub const Alignment = types.Alignment; |
| 182 | 182 | ||
| ... | @@ -287,7 +287,7 @@ pub const StringTable = struct { | ... | @@ -287,7 +287,7 @@ pub const StringTable = struct { |
| 287 | std.hash_map.default_max_load_percentage, | 287 | std.hash_map.default_max_load_percentage, |
| 288 | ) = .{}, | 288 | ) = .{}, |
| 289 | /// Holds the actual data of the string table. | 289 | /// Holds the actual data of the string table. |
| 290 | string_data: std.ArrayListUnmanaged(u8) = .{}, | 290 | string_data: std.ArrayListUnmanaged(u8) = .empty, |
| 291 | 291 | ||
| 292 | /// Accepts a string and searches for a corresponding string. | 292 | /// Accepts a string and searches for a corresponding string. |
| 293 | /// When found, de-duplicates the string and returns the existing offset instead. | 293 | /// When found, de-duplicates the string and returns the existing offset instead. |
| ... | @@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void { | ... | @@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void { |
| 1698 | 1698 | ||
| 1699 | fn sortDataSegments(wasm: *Wasm) !void { | 1699 | fn sortDataSegments(wasm: *Wasm) !void { |
| 1700 | const gpa = wasm.base.comp.gpa; | 1700 | const gpa = wasm.base.comp.gpa; |
| 1701 | var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .{}; | 1701 | var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .empty; |
| 1702 | try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count()); | 1702 | try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count()); |
| 1703 | errdefer new_mapping.deinit(gpa); | 1703 | errdefer new_mapping.deinit(gpa); |
| 1704 | 1704 |
src/link/Wasm/Archive.zig+1-1| ... | @@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined, | ... | @@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined, |
| 12 | /// Parsed table of contents. | 12 | /// Parsed table of contents. |
| 13 | /// Each symbol name points to a list of all definition | 13 | /// Each symbol name points to a list of all definition |
| 14 | /// sites within the current static archive. | 14 | /// sites within the current static archive. |
| 15 | toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .{}, | 15 | toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .empty, |
| 16 | 16 | ||
| 17 | // Archive files start with the ARMAG identifying string. Then follows a | 17 | // Archive files start with the ARMAG identifying string. Then follows a |
| 18 | // `struct ar_hdr', and as many bytes of member file data as its `ar_size' | 18 | // `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, | ... | @@ -6,9 +6,9 @@ sym_index: Symbol.Index, |
| 6 | /// Size of the atom, used to calculate section sizes in the final binary | 6 | /// Size of the atom, used to calculate section sizes in the final binary |
| 7 | size: u32 = 0, | 7 | size: u32 = 0, |
| 8 | /// List of relocations belonging to this atom | 8 | /// List of relocations belonging to this atom |
| 9 | relocs: std.ArrayListUnmanaged(types.Relocation) = .{}, | 9 | relocs: std.ArrayListUnmanaged(types.Relocation) = .empty, |
| 10 | /// Contains the binary data of an atom, which can be non-relocated | 10 | /// Contains the binary data of an atom, which can be non-relocated |
| 11 | code: std.ArrayListUnmanaged(u8) = .{}, | 11 | code: std.ArrayListUnmanaged(u8) = .empty, |
| 12 | /// For code this is 1, for data this is set to the highest value of all segments | 12 | /// For code this is 1, for data this is set to the highest value of all segments |
| 13 | alignment: Wasm.Alignment = .@"1", | 13 | alignment: Wasm.Alignment = .@"1", |
| 14 | /// Offset into the section where the atom lives, this already accounts | 14 | /// Offset into the section where the atom lives, this already accounts |
| ... | @@ -22,7 +22,7 @@ original_offset: u32 = 0, | ... | @@ -22,7 +22,7 @@ original_offset: u32 = 0, |
| 22 | prev: Atom.Index = .null, | 22 | prev: Atom.Index = .null, |
| 23 | /// Contains atoms local to a decl, all managed by this `Atom`. | 23 | /// Contains atoms local to a decl, all managed by this `Atom`. |
| 24 | /// When the parent atom is being freed, it will also do so for all local atoms. | 24 | /// When the parent atom is being freed, it will also do so for all local atoms. |
| 25 | locals: std.ArrayListUnmanaged(Atom.Index) = .{}, | 25 | locals: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 26 | 26 | ||
| 27 | /// Represents the index of an Atom where `null` is considered | 27 | /// Represents the index of an Atom where `null` is considered |
| 28 | /// an invalid atom. | 28 | /// an invalid atom. |
src/link/Wasm/Object.zig+3-3| ... | @@ -51,7 +51,7 @@ start: ?u32 = null, | ... | @@ -51,7 +51,7 @@ start: ?u32 = null, |
| 51 | features: []const types.Feature = &.{}, | 51 | features: []const types.Feature = &.{}, |
| 52 | /// A table that maps the relocations we must perform where the key represents | 52 | /// A table that maps the relocations we must perform where the key represents |
| 53 | /// the section that the list of relocations applies to. | 53 | /// the section that the list of relocations applies to. |
| 54 | relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .{}, | 54 | relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .empty, |
| 55 | /// Table of symbols belonging to this Object file | 55 | /// Table of symbols belonging to this Object file |
| 56 | symtable: []Symbol = &.{}, | 56 | symtable: []Symbol = &.{}, |
| 57 | /// Extra metadata about the linking section, such as alignment of segments and their name | 57 | /// Extra metadata about the linking section, such as alignment of segments and their name |
| ... | @@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{}, | ... | @@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{}, |
| 62 | comdat_info: []const types.Comdat = &.{}, | 62 | comdat_info: []const types.Comdat = &.{}, |
| 63 | /// Represents non-synthetic sections that can essentially be mem-cpy'd into place | 63 | /// Represents non-synthetic sections that can essentially be mem-cpy'd into place |
| 64 | /// after performing relocations. | 64 | /// after performing relocations. |
| 65 | relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .{}, | 65 | relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .empty, |
| 66 | /// String table for all strings required by the object file, such as symbol names, | 66 | /// String table for all strings required by the object file, such as symbol names, |
| 67 | /// import name, module name and export names. Each string will be deduplicated | 67 | /// import name, module name and export names. Each string will be deduplicated |
| 68 | /// and returns an offset into the table. | 68 | /// and returns an offset into the table. |
| ... | @@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type { |
| 379 | try parser.parseFeatures(gpa); | 379 | try parser.parseFeatures(gpa); |
| 380 | } else if (std.mem.startsWith(u8, name, ".debug")) { | 380 | } else if (std.mem.startsWith(u8, name, ".debug")) { |
| 381 | const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom); | 381 | 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; |
| 383 | defer relocatable_data.deinit(gpa); | 383 | defer relocatable_data.deinit(gpa); |
| 384 | if (!gop.found_existing) { | 384 | if (!gop.found_existing) { |
| 385 | gop.value_ptr.* = &.{}; | 385 | gop.value_ptr.* = &.{}; |
src/link/Wasm/ZigObject.zig+15-15| ... | @@ -8,37 +8,37 @@ path: []const u8, | ... | @@ -8,37 +8,37 @@ path: []const u8, |
| 8 | index: File.Index, | 8 | index: File.Index, |
| 9 | /// Map of all `Nav` that are currently alive. | 9 | /// Map of all `Nav` that are currently alive. |
| 10 | /// Each index maps to the corresponding `NavInfo`. | 10 | /// Each index maps to the corresponding `NavInfo`. |
| 11 | navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .{}, | 11 | navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .empty, |
| 12 | /// List of function type signatures for this Zig module. | 12 | /// List of function type signatures for this Zig module. |
| 13 | func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, | 13 | func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, |
| 14 | /// List of `std.wasm.Func`. Each entry contains the function signature, | 14 | /// List of `std.wasm.Func`. Each entry contains the function signature, |
| 15 | /// rather than the actual body. | 15 | /// rather than the actual body. |
| 16 | functions: std.ArrayListUnmanaged(std.wasm.Func) = .{}, | 16 | functions: std.ArrayListUnmanaged(std.wasm.Func) = .empty, |
| 17 | /// List of indexes pointing to an entry within the `functions` list which has been removed. | 17 | /// List of indexes pointing to an entry within the `functions` list which has been removed. |
| 18 | functions_free_list: std.ArrayListUnmanaged(u32) = .{}, | 18 | functions_free_list: std.ArrayListUnmanaged(u32) = .empty, |
| 19 | /// Map of symbol locations, represented by its `types.Import`. | 19 | /// Map of symbol locations, represented by its `types.Import`. |
| 20 | imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .{}, | 20 | imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .empty, |
| 21 | /// List of WebAssembly globals. | 21 | /// List of WebAssembly globals. |
| 22 | globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, | 22 | globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, |
| 23 | /// Mapping between an `Atom` and its type index representing the Wasm | 23 | /// Mapping between an `Atom` and its type index representing the Wasm |
| 24 | /// type of the function signature. | 24 | /// type of the function signature. |
| 25 | atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .{}, | 25 | atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .empty, |
| 26 | /// List of all symbols generated by Zig code. | 26 | /// List of all symbols generated by Zig code. |
| 27 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | 27 | symbols: std.ArrayListUnmanaged(Symbol) = .empty, |
| 28 | /// Map from symbol name offset to their index into the `symbols` list. | 28 | /// Map from symbol name offset to their index into the `symbols` list. |
| 29 | global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, | 29 | global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, |
| 30 | /// List of symbol indexes which are free to be used. | 30 | /// List of symbol indexes which are free to be used. |
| 31 | symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 31 | symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 32 | /// Extra metadata about the linking section, such as alignment of segments and their name. | 32 | /// Extra metadata about the linking section, such as alignment of segments and their name. |
| 33 | segment_info: std.ArrayListUnmanaged(types.Segment) = .{}, | 33 | segment_info: std.ArrayListUnmanaged(types.Segment) = .empty, |
| 34 | /// List of indexes which contain a free slot in the `segment_info` list. | 34 | /// List of indexes which contain a free slot in the `segment_info` list. |
| 35 | segment_free_list: std.ArrayListUnmanaged(u32) = .{}, | 35 | segment_free_list: std.ArrayListUnmanaged(u32) = .empty, |
| 36 | /// File encapsulated string table, used to deduplicate strings within the generated file. | 36 | /// File encapsulated string table, used to deduplicate strings within the generated file. |
| 37 | string_table: StringTable = .{}, | 37 | string_table: StringTable = .{}, |
| 38 | /// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index. | 38 | /// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index. |
| 39 | uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, | 39 | uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, |
| 40 | /// List of atom indexes of functions that are generated by the backend. | 40 | /// List of atom indexes of functions that are generated by the backend. |
| 41 | synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .{}, | 41 | synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .empty, |
| 42 | /// Represents the symbol index of the error name table | 42 | /// Represents the symbol index of the error name table |
| 43 | /// When this is `null`, no code references an error using runtime `@errorName`. | 43 | /// When this is `null`, no code references an error using runtime `@errorName`. |
| 44 | /// During initializion, a symbol with corresponding atom will be created that is | 44 | /// During initializion, a symbol with corresponding atom will be created that is |
| ... | @@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null, | ... | @@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null, |
| 88 | 88 | ||
| 89 | const NavInfo = struct { | 89 | const NavInfo = struct { |
| 90 | atom: Atom.Index = .null, | 90 | atom: Atom.Index = .null, |
| 91 | exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, | 91 | exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, |
| 92 | 92 | ||
| 93 | fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index { | 93 | fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index { |
| 94 | for (ni.exports.items) |sym_index| { | 94 | for (ni.exports.items) |sym_index| { |
src/link/table_section.zig+3-3| ... | @@ -1,8 +1,8 @@ | ... | @@ -1,8 +1,8 @@ |
| 1 | pub fn TableSection(comptime Entry: type) type { | 1 | pub fn TableSection(comptime Entry: type) type { |
| 2 | return struct { | 2 | return struct { |
| 3 | entries: std.ArrayListUnmanaged(Entry) = .{}, | 3 | entries: std.ArrayListUnmanaged(Entry) = .empty, |
| 4 | free_list: std.ArrayListUnmanaged(Index) = .{}, | 4 | free_list: std.ArrayListUnmanaged(Index) = .empty, |
| 5 | lookup: std.AutoHashMapUnmanaged(Entry, Index) = .{}, | 5 | lookup: std.AutoHashMapUnmanaged(Entry, Index) = .empty, |
| 6 | 6 | ||
| 7 | pub fn deinit(self: *Self, allocator: Allocator) void { | 7 | pub fn deinit(self: *Self, allocator: Allocator) void { |
| 8 | self.entries.deinit(allocator); | 8 | self.entries.deinit(allocator); |
src/link/tapi/parse.zig+4-4| ... | @@ -115,7 +115,7 @@ pub const Node = struct { | ... | @@ -115,7 +115,7 @@ pub const Node = struct { |
| 115 | .start = undefined, | 115 | .start = undefined, |
| 116 | .end = undefined, | 116 | .end = undefined, |
| 117 | }, | 117 | }, |
| 118 | values: std.ArrayListUnmanaged(Entry) = .{}, | 118 | values: std.ArrayListUnmanaged(Entry) = .empty, |
| 119 | 119 | ||
| 120 | pub const base_tag: Node.Tag = .map; | 120 | pub const base_tag: Node.Tag = .map; |
| 121 | 121 | ||
| ... | @@ -161,7 +161,7 @@ pub const Node = struct { | ... | @@ -161,7 +161,7 @@ pub const Node = struct { |
| 161 | .start = undefined, | 161 | .start = undefined, |
| 162 | .end = undefined, | 162 | .end = undefined, |
| 163 | }, | 163 | }, |
| 164 | values: std.ArrayListUnmanaged(*Node) = .{}, | 164 | values: std.ArrayListUnmanaged(*Node) = .empty, |
| 165 | 165 | ||
| 166 | pub const base_tag: Node.Tag = .list; | 166 | pub const base_tag: Node.Tag = .list; |
| 167 | 167 | ||
| ... | @@ -195,7 +195,7 @@ pub const Node = struct { | ... | @@ -195,7 +195,7 @@ pub const Node = struct { |
| 195 | .start = undefined, | 195 | .start = undefined, |
| 196 | .end = undefined, | 196 | .end = undefined, |
| 197 | }, | 197 | }, |
| 198 | string_value: std.ArrayListUnmanaged(u8) = .{}, | 198 | string_value: std.ArrayListUnmanaged(u8) = .empty, |
| 199 | 199 | ||
| 200 | pub const base_tag: Node.Tag = .value; | 200 | pub const base_tag: Node.Tag = .value; |
| 201 | 201 | ||
| ... | @@ -227,7 +227,7 @@ pub const Tree = struct { | ... | @@ -227,7 +227,7 @@ pub const Tree = struct { |
| 227 | source: []const u8, | 227 | source: []const u8, |
| 228 | tokens: []Token, | 228 | tokens: []Token, |
| 229 | line_cols: std.AutoHashMap(TokenIndex, LineCol), | 229 | line_cols: std.AutoHashMap(TokenIndex, LineCol), |
| 230 | docs: std.ArrayListUnmanaged(*Node) = .{}, | 230 | docs: std.ArrayListUnmanaged(*Node) = .empty, |
| 231 | 231 | ||
| 232 | pub fn init(allocator: Allocator) Tree { | 232 | pub fn init(allocator: Allocator) Tree { |
| 233 | return .{ | 233 | return .{ |
src/main.zig+15-15| ... | @@ -126,7 +126,7 @@ const debug_usage = normal_usage ++ | ... | @@ -126,7 +126,7 @@ const debug_usage = normal_usage ++ |
| 126 | const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage; | 126 | const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage; |
| 127 | const default_local_zig_cache_basename = ".zig-cache"; | 127 | const default_local_zig_cache_basename = ".zig-cache"; |
| 128 | 128 | ||
| 129 | var log_scopes: std.ArrayListUnmanaged([]const u8) = .{}; | 129 | var log_scopes: std.ArrayListUnmanaged([]const u8) = .empty; |
| 130 | 130 | ||
| 131 | pub fn log( | 131 | pub fn log( |
| 132 | comptime level: std.log.Level, | 132 | comptime level: std.log.Level, |
| ... | @@ -895,14 +895,14 @@ fn buildOutputType( | ... | @@ -895,14 +895,14 @@ fn buildOutputType( |
| 895 | var linker_module_definition_file: ?[]const u8 = null; | 895 | var linker_module_definition_file: ?[]const u8 = null; |
| 896 | var test_no_exec = false; | 896 | var test_no_exec = false; |
| 897 | var entry: Compilation.CreateOptions.Entry = .default; | 897 | var entry: Compilation.CreateOptions.Entry = .default; |
| 898 | var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}; | 898 | var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; |
| 899 | var stack_size: ?u64 = null; | 899 | var stack_size: ?u64 = null; |
| 900 | var image_base: ?u64 = null; | 900 | var image_base: ?u64 = null; |
| 901 | var link_eh_frame_hdr = false; | 901 | var link_eh_frame_hdr = false; |
| 902 | var link_emit_relocs = false; | 902 | var link_emit_relocs = false; |
| 903 | var build_id: ?std.zig.BuildId = null; | 903 | var build_id: ?std.zig.BuildId = null; |
| 904 | var runtime_args_start: ?usize = null; | 904 | var runtime_args_start: ?usize = null; |
| 905 | var test_filters: std.ArrayListUnmanaged([]const u8) = .{}; | 905 | var test_filters: std.ArrayListUnmanaged([]const u8) = .empty; |
| 906 | var test_name_prefix: ?[]const u8 = null; | 906 | var test_name_prefix: ?[]const u8 = null; |
| 907 | var test_runner_path: ?[]const u8 = null; | 907 | var test_runner_path: ?[]const u8 = null; |
| 908 | var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); | 908 | var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); |
| ... | @@ -931,12 +931,12 @@ fn buildOutputType( | ... | @@ -931,12 +931,12 @@ fn buildOutputType( |
| 931 | var pdb_out_path: ?[]const u8 = null; | 931 | var pdb_out_path: ?[]const u8 = null; |
| 932 | var error_limit: ?Zcu.ErrorInt = null; | 932 | var error_limit: ?Zcu.ErrorInt = null; |
| 933 | // These are before resolving sysroot. | 933 | // These are before resolving sysroot. |
| 934 | var extra_cflags: std.ArrayListUnmanaged([]const u8) = .{}; | 934 | var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty; |
| 935 | var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .{}; | 935 | var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty; |
| 936 | var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}; | 936 | var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; |
| 937 | var rc_includes: Compilation.RcIncludes = .any; | 937 | var rc_includes: Compilation.RcIncludes = .any; |
| 938 | var manifest_file: ?[]const u8 = null; | 938 | 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; |
| 940 | 940 | ||
| 941 | // Tracks the position in c_source_files which have already their owner populated. | 941 | // Tracks the position in c_source_files which have already their owner populated. |
| 942 | var c_source_files_owner_index: usize = 0; | 942 | var c_source_files_owner_index: usize = 0; |
| ... | @@ -944,7 +944,7 @@ fn buildOutputType( | ... | @@ -944,7 +944,7 @@ fn buildOutputType( |
| 944 | var rc_source_files_owner_index: usize = 0; | 944 | var rc_source_files_owner_index: usize = 0; |
| 945 | 945 | ||
| 946 | // null means replace with the test executable binary | 946 | // 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; |
| 948 | 948 | ||
| 949 | // These get set by CLI flags and then snapshotted when a `-M` flag is | 949 | // These get set by CLI flags and then snapshotted when a `-M` flag is |
| 950 | // encountered. | 950 | // encountered. |
| ... | @@ -953,8 +953,8 @@ fn buildOutputType( | ... | @@ -953,8 +953,8 @@ fn buildOutputType( |
| 953 | // These get appended to by CLI flags and then slurped when a `-M` flag | 953 | // These get appended to by CLI flags and then slurped when a `-M` flag |
| 954 | // is encountered. | 954 | // is encountered. |
| 955 | var cssan: ClangSearchSanitizer = .{}; | 955 | var cssan: ClangSearchSanitizer = .{}; |
| 956 | var cc_argv: std.ArrayListUnmanaged([]const u8) = .{}; | 956 | var cc_argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 957 | var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; | 957 | var deps: std.ArrayListUnmanaged(CliModule.Dep) = .empty; |
| 958 | 958 | ||
| 959 | // Contains every module specified via -M. The dependencies are added | 959 | // Contains every module specified via -M. The dependencies are added |
| 960 | // after argument parsing is completed. We use a StringArrayHashMap to make | 960 | // after argument parsing is completed. We use a StringArrayHashMap to make |
| ... | @@ -2806,7 +2806,7 @@ fn buildOutputType( | ... | @@ -2806,7 +2806,7 @@ fn buildOutputType( |
| 2806 | create_module.opts.emit_bin = emit_bin != .no; | 2806 | create_module.opts.emit_bin = emit_bin != .no; |
| 2807 | create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0; | 2807 | create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0; |
| 2808 | 2808 | ||
| 2809 | var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .{}; | 2809 | var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .empty; |
| 2810 | // `builtin_modules` allocated into `arena`, so no deinit | 2810 | // `builtin_modules` allocated into `arena`, so no deinit |
| 2811 | const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules); | 2811 | const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules); |
| 2812 | for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { | 2812 | for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { |
| ... | @@ -3290,7 +3290,7 @@ fn buildOutputType( | ... | @@ -3290,7 +3290,7 @@ fn buildOutputType( |
| 3290 | 3290 | ||
| 3291 | process.raiseFileDescriptorLimit(); | 3291 | process.raiseFileDescriptorLimit(); |
| 3292 | 3292 | ||
| 3293 | var file_system_inputs: std.ArrayListUnmanaged(u8) = .{}; | 3293 | var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty; |
| 3294 | defer file_system_inputs.deinit(gpa); | 3294 | defer file_system_inputs.deinit(gpa); |
| 3295 | 3295 | ||
| 3296 | const comp = Compilation.create(gpa, arena, .{ | 3296 | const comp = Compilation.create(gpa, arena, .{ |
| ... | @@ -5451,7 +5451,7 @@ fn jitCmd( | ... | @@ -5451,7 +5451,7 @@ fn jitCmd( |
| 5451 | }); | 5451 | }); |
| 5452 | defer thread_pool.deinit(); | 5452 | defer thread_pool.deinit(); |
| 5453 | 5453 | ||
| 5454 | var child_argv: std.ArrayListUnmanaged([]const u8) = .{}; | 5454 | var child_argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 5455 | try child_argv.ensureUnusedCapacity(arena, args.len + 4); | 5455 | try child_argv.ensureUnusedCapacity(arena, args.len + 4); |
| 5456 | 5456 | ||
| 5457 | // We want to release all the locks before executing the child process, so we make a nice | 5457 | // We want to release all the locks before executing the child process, so we make a nice |
| ... | @@ -6553,7 +6553,7 @@ fn cmdChangelist( | ... | @@ -6553,7 +6553,7 @@ fn cmdChangelist( |
| 6553 | process.exit(1); | 6553 | process.exit(1); |
| 6554 | } | 6554 | } |
| 6555 | 6555 | ||
| 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; |
| 6557 | defer inst_map.deinit(gpa); | 6557 | defer inst_map.deinit(gpa); |
| 6558 | 6558 | ||
| 6559 | try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map); | 6559 | try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map); |
| ... | @@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { | ... | @@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { |
| 6738 | /// Silently ignore superfluous search dirs. | 6738 | /// Silently ignore superfluous search dirs. |
| 6739 | /// Warn when a dir is added to multiple searchlists. | 6739 | /// Warn when a dir is added to multiple searchlists. |
| 6740 | const ClangSearchSanitizer = struct { | 6740 | const ClangSearchSanitizer = struct { |
| 6741 | map: std.StringHashMapUnmanaged(Membership) = .{}, | 6741 | map: std.StringHashMapUnmanaged(Membership) = .empty, |
| 6742 | 6742 | ||
| 6743 | fn reset(self: *@This()) void { | 6743 | fn reset(self: *@This()) void { |
| 6744 | self.map.clearRetainingCapacity(); | 6744 | self.map.clearRetainingCapacity(); |
src/register_manager.zig+1-1| ... | @@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type { | ... | @@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type { |
| 516 | return struct { | 516 | return struct { |
| 517 | allocator: Allocator, | 517 | allocator: Allocator, |
| 518 | register_manager: Register.RM = .{}, | 518 | register_manager: Register.RM = .{}, |
| 519 | spilled: std.ArrayListUnmanaged(Register) = .{}, | 519 | spilled: std.ArrayListUnmanaged(Register) = .empty, |
| 520 | 520 | ||
| 521 | const Self = @This(); | 521 | const Self = @This(); |
| 522 | 522 |
src/translate_c.zig+6-6| ... | @@ -27,23 +27,23 @@ pub const Context = struct { | ... | @@ -27,23 +27,23 @@ pub const Context = struct { |
| 27 | gpa: mem.Allocator, | 27 | gpa: mem.Allocator, |
| 28 | arena: mem.Allocator, | 28 | arena: mem.Allocator, |
| 29 | source_manager: *clang.SourceManager, | 29 | source_manager: *clang.SourceManager, |
| 30 | decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{}, | 30 | decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty, |
| 31 | alias_list: AliasList, | 31 | alias_list: AliasList, |
| 32 | global_scope: *Scope.Root, | 32 | global_scope: *Scope.Root, |
| 33 | clang_context: *clang.ASTContext, | 33 | clang_context: *clang.ASTContext, |
| 34 | mangle_count: u32 = 0, | 34 | mangle_count: u32 = 0, |
| 35 | /// Table of record decls that have been demoted to opaques. | 35 | /// 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, |
| 37 | /// Table of unnamed enums and records that are child types of typedefs. | 37 | /// 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, |
| 39 | /// Needed to decide if we are parsing a typename | 39 | /// Needed to decide if we are parsing a typename |
| 40 | typedefs: std.StringArrayHashMapUnmanaged(void) = .{}, | 40 | typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 41 | 41 | ||
| 42 | /// This one is different than the root scope's name table. This contains | 42 | /// This one is different than the root scope's name table. This contains |
| 43 | /// a list of names that we found by visiting all the top level decls without | 43 | /// a list of names that we found by visiting all the top level decls without |
| 44 | /// translating them. The other maps are updated as we translate; this one is updated | 44 | /// translating them. The other maps are updated as we translate; this one is updated |
| 45 | /// up front in a pre-processing step. | 45 | /// up front in a pre-processing step. |
| 46 | global_names: std.StringArrayHashMapUnmanaged(void) = .{}, | 46 | global_names: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 47 | 47 | ||
| 48 | /// This is similar to `global_names`, but contains names which we would | 48 | /// This is similar to `global_names`, but contains names which we would |
| 49 | /// *like* to use, but do not strictly *have* to if they are unavailable. | 49 | /// *like* to use, but do not strictly *have* to if they are unavailable. |
| ... | @@ -52,7 +52,7 @@ pub const Context = struct { | ... | @@ -52,7 +52,7 @@ pub const Context = struct { |
| 52 | /// may be mangled. | 52 | /// may be mangled. |
| 53 | /// This is distinct from `global_names` so we can detect at a type | 53 | /// This is distinct from `global_names` so we can detect at a type |
| 54 | /// declaration whether or not the name is available. | 54 | /// declaration whether or not the name is available. |
| 55 | weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{}, | 55 | weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, |
| 56 | 56 | ||
| 57 | pattern_list: PatternList, | 57 | pattern_list: PatternList, |
| 58 | 58 |
test/behavior/fn.zig+1-1| ... | @@ -415,7 +415,7 @@ test "import passed byref to function in return type" { | ... | @@ -415,7 +415,7 @@ test "import passed byref to function in return type" { |
| 415 | 415 | ||
| 416 | const S = struct { | 416 | const S = struct { |
| 417 | fn get() @import("std").ArrayListUnmanaged(i32) { | 417 | fn get() @import("std").ArrayListUnmanaged(i32) { |
| 418 | const x: @import("std").ArrayListUnmanaged(i32) = .{}; | 418 | const x: @import("std").ArrayListUnmanaged(i32) = .empty; |
| 419 | return x; | 419 | return x; |
| 420 | } | 420 | } |
| 421 | }; | 421 | }; |
test/compare_output.zig+3-3| ... | @@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 291 | \\ stdout.print("before\n", .{}) catch unreachable; | 291 | \\ stdout.print("before\n", .{}) catch unreachable; |
| 292 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; | 292 | \\ defer stdout.print("defer1\n", .{}) catch unreachable; |
| 293 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; | 293 | \\ defer stdout.print("defer2\n", .{}) catch unreachable; |
| 294 | \\ var gpa = @import("std").heap.GeneralPurposeAllocator(.{}){}; | 294 | \\ var gpa: @import("std").heap.GeneralPurposeAllocator(.{}) = .init; |
| 295 | \\ defer _ = gpa.deinit(); | 295 | \\ defer _ = gpa.deinit(); |
| 296 | \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator()); | 296 | \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator()); |
| 297 | \\ defer arena.deinit(); | 297 | \\ defer arena.deinit(); |
| ... | @@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 361 | \\const os = std.os; | 361 | \\const os = std.os; |
| 362 | \\ | 362 | \\ |
| 363 | \\pub fn main() !void { | 363 | \\pub fn main() !void { |
| 364 | \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 364 | \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 365 | \\ defer _ = gpa.deinit(); | 365 | \\ defer _ = gpa.deinit(); |
| 366 | \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); | 366 | \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); |
| 367 | \\ defer arena.deinit(); | 367 | \\ defer arena.deinit(); |
| ... | @@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 402 | \\const os = std.os; | 402 | \\const os = std.os; |
| 403 | \\ | 403 | \\ |
| 404 | \\pub fn main() !void { | 404 | \\pub fn main() !void { |
| 405 | \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 405 | \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 406 | \\ defer _ = gpa.deinit(); | 406 | \\ defer _ = gpa.deinit(); |
| 407 | \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); | 407 | \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator()); |
| 408 | \\ defer arena.deinit(); | 408 | \\ defer arena.deinit(); |
test/standalone/coff_dwarf/main.zig+1-1| ... | @@ -5,7 +5,7 @@ const testing = std.testing; | ... | @@ -5,7 +5,7 @@ const testing = std.testing; |
| 5 | extern fn add(a: u32, b: u32, addr: *usize) u32; | 5 | extern fn add(a: u32, b: u32, addr: *usize) u32; |
| 6 | 6 | ||
| 7 | pub fn main() !void { | 7 | pub fn main() !void { |
| 8 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 8 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 9 | defer assert(gpa.deinit() == .ok); | 9 | defer assert(gpa.deinit() == .ok); |
| 10 | const allocator = gpa.allocator(); | 10 | const allocator = gpa.allocator(); |
| 11 | 11 |
test/standalone/empty_env/main.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() !void { | 3 | pub fn main() !void { |
| 4 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | defer _ = gpa.deinit(); | 5 | defer _ = gpa.deinit(); |
| 6 | const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map"); | 6 | const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map"); |
| 7 | try std.testing.expect(env_map.count() == 0); | 7 | try std.testing.expect(env_map.count() == 0); |
test/standalone/load_dynamic_library/main.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() !void { | 3 | pub fn main() !void { |
| 4 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | defer _ = gpa.deinit(); | 5 | defer _ = gpa.deinit(); |
| 6 | const args = try std.process.argsAlloc(gpa.allocator()); | 6 | const args = try std.process.argsAlloc(gpa.allocator()); |
| 7 | defer std.process.argsFree(gpa.allocator(), args); | 7 | defer std.process.argsFree(gpa.allocator(), args); |
test/standalone/self_exe_symlink/create-symlink.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() anyerror!void { | 3 | pub fn main() anyerror!void { |
| 4 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); | 5 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); |
| 6 | const allocator = gpa.allocator(); | 6 | const allocator = gpa.allocator(); |
| 7 | 7 |
test/standalone/self_exe_symlink/main.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() !void { | 3 | pub fn main() !void { |
| 4 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | defer std.debug.assert(gpa.deinit() == .ok); | 5 | defer std.debug.assert(gpa.deinit() == .ok); |
| 6 | const allocator = gpa.allocator(); | 6 | const allocator = gpa.allocator(); |
| 7 | 7 |
test/standalone/simple/brace_expansion.zig+1-1| ... | @@ -15,7 +15,7 @@ const Token = union(enum) { | ... | @@ -15,7 +15,7 @@ const Token = union(enum) { |
| 15 | Eof, | 15 | Eof, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 18 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 19 | var global_allocator = gpa.allocator(); | 19 | var global_allocator = gpa.allocator(); |
| 20 | 20 | ||
| 21 | fn tokenize(input: []const u8) !ArrayList(Token) { | 21 | fn tokenize(input: []const u8) !ArrayList(Token) { |
test/standalone/windows_argv/fuzz.zig+1-1| ... | @@ -4,7 +4,7 @@ const windows = std.os.windows; | ... | @@ -4,7 +4,7 @@ const windows = std.os.windows; |
| 4 | const Allocator = std.mem.Allocator; | 4 | const Allocator = std.mem.Allocator; |
| 5 | 5 | ||
| 6 | pub fn main() !void { | 6 | pub fn main() !void { |
| 7 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 7 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 8 | defer std.debug.assert(gpa.deinit() == .ok); | 8 | defer std.debug.assert(gpa.deinit() == .ok); |
| 9 | const allocator = gpa.allocator(); | 9 | const allocator = gpa.allocator(); |
| 10 | 10 |
test/standalone/windows_bat_args/fuzz.zig+1-1| ... | @@ -3,7 +3,7 @@ const builtin = @import("builtin"); | ... | @@ -3,7 +3,7 @@ const builtin = @import("builtin"); |
| 3 | const Allocator = std.mem.Allocator; | 3 | const Allocator = std.mem.Allocator; |
| 4 | 4 | ||
| 5 | pub fn main() anyerror!void { | 5 | pub fn main() anyerror!void { |
| 6 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 6 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 7 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); | 7 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); |
| 8 | const allocator = gpa.allocator(); | 8 | const allocator = gpa.allocator(); |
| 9 | 9 |
test/standalone/windows_bat_args/test.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn main() anyerror!void { | 3 | pub fn main() anyerror!void { |
| 4 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 4 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 5 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); | 5 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); |
| 6 | const allocator = gpa.allocator(); | 6 | const allocator = gpa.allocator(); |
| 7 | 7 |
test/standalone/windows_spawn/main.zig+1-1| ... | @@ -3,7 +3,7 @@ const windows = std.os.windows; | ... | @@ -3,7 +3,7 @@ const windows = std.os.windows; |
| 3 | const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral; | 3 | const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral; |
| 4 | 4 | ||
| 5 | pub fn main() anyerror!void { | 5 | pub fn main() anyerror!void { |
| 6 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 6 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 7 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); | 7 | defer if (gpa.deinit() == .leak) @panic("found memory leaks"); |
| 8 | const allocator = gpa.allocator(); | 8 | const allocator = gpa.allocator(); |
| 9 | 9 |
tools/doctest.zig+2-2| ... | @@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { | ... | @@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code { |
| 868 | 868 | ||
| 869 | var mode: std.builtin.OptimizeMode = .Debug; | 869 | var mode: std.builtin.OptimizeMode = .Debug; |
| 870 | var link_mode: ?std.builtin.LinkMode = null; | 870 | var link_mode: ?std.builtin.LinkMode = null; |
| 871 | var link_objects: std.ArrayListUnmanaged([]const u8) = .{}; | 871 | var link_objects: std.ArrayListUnmanaged([]const u8) = .empty; |
| 872 | var additional_options: std.ArrayListUnmanaged([]const u8) = .{}; | 872 | var additional_options: std.ArrayListUnmanaged([]const u8) = .empty; |
| 873 | var target_str: ?[]const u8 = null; | 873 | var target_str: ?[]const u8 = null; |
| 874 | var link_libc = false; | 874 | var link_libc = false; |
| 875 | var disable_cache = false; | 875 | var disable_cache = false; |
tools/dump-cov.zig+2-2| ... | @@ -8,7 +8,7 @@ const assert = std.debug.assert; | ... | @@ -8,7 +8,7 @@ const assert = std.debug.assert; |
| 8 | const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader; | 8 | const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader; |
| 9 | 9 | ||
| 10 | pub fn main() !void { | 10 | pub fn main() !void { |
| 11 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; | 11 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 12 | defer _ = general_purpose_allocator.deinit(); | 12 | defer _ = general_purpose_allocator.deinit(); |
| 13 | const gpa = general_purpose_allocator.allocator(); | 13 | const gpa = general_purpose_allocator.allocator(); |
| 14 | 14 | ||
| ... | @@ -55,7 +55,7 @@ pub fn main() !void { | ... | @@ -55,7 +55,7 @@ pub fn main() !void { |
| 55 | try stdout.print("{any}\n", .{header.*}); | 55 | try stdout.print("{any}\n", .{header.*}); |
| 56 | const pcs = header.pcAddrs(); | 56 | const pcs = header.pcAddrs(); |
| 57 | 57 | ||
| 58 | var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .{}; | 58 | var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; |
| 59 | try indexed_pcs.entries.resize(arena, pcs.len); | 59 | try indexed_pcs.entries.resize(arena, pcs.len); |
| 60 | @memcpy(indexed_pcs.entries.items(.key), pcs); | 60 | @memcpy(indexed_pcs.entries.items(.key), pcs); |
| 61 | try indexed_pcs.reIndex(arena); | 61 | try indexed_pcs.reIndex(arena); |
tools/generate_JSONTestSuite.zig+1-1| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | const std = @import("std"); | 3 | const std = @import("std"); |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | 6 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 7 | var allocator = gpa.allocator(); | 7 | var allocator = gpa.allocator(); |
| 8 | 8 | ||
| 9 | var output = std.io.getStdOut().writer(); | 9 | 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 { | ... | @@ -25,7 +25,7 @@ fn cName(ty: std.Target.CType) []const u8 { |
| 25 | }; | 25 | }; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; | 28 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 29 | 29 | ||
| 30 | pub fn main() !void { | 30 | pub fn main() !void { |
| 31 | const gpa = general_purpose_allocator.allocator(); | 31 | const gpa = general_purpose_allocator.allocator(); |
tools/incr-check.zig+4-4| ... | @@ -73,7 +73,7 @@ pub fn main() !void { | ... | @@ -73,7 +73,7 @@ pub fn main() !void { |
| 73 | else | 73 | else |
| 74 | null; | 74 | null; |
| 75 | 75 | ||
| 76 | var child_args: std.ArrayListUnmanaged([]const u8) = .{}; | 76 | var child_args: std.ArrayListUnmanaged([]const u8) = .empty; |
| 77 | try child_args.appendSlice(arena, &.{ | 77 | try child_args.appendSlice(arena, &.{ |
| 78 | resolved_zig_exe, | 78 | resolved_zig_exe, |
| 79 | "build-exe", | 79 | "build-exe", |
| ... | @@ -107,7 +107,7 @@ pub fn main() !void { | ... | @@ -107,7 +107,7 @@ pub fn main() !void { |
| 107 | child.cwd_dir = tmp_dir; | 107 | child.cwd_dir = tmp_dir; |
| 108 | child.cwd = tmp_dir_path; | 108 | child.cwd = tmp_dir_path; |
| 109 | 109 | ||
| 110 | var cc_child_args: std.ArrayListUnmanaged([]const u8) = .{}; | 110 | var cc_child_args: std.ArrayListUnmanaged([]const u8) = .empty; |
| 111 | if (emit == .c) { | 111 | if (emit == .c) { |
| 112 | const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe| | 112 | const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe| |
| 113 | try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe) | 113 | try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe) |
| ... | @@ -492,8 +492,8 @@ const Case = struct { | ... | @@ -492,8 +492,8 @@ const Case = struct { |
| 492 | }; | 492 | }; |
| 493 | 493 | ||
| 494 | fn parse(arena: Allocator, bytes: []const u8) !Case { | 494 | fn parse(arena: Allocator, bytes: []const u8) !Case { |
| 495 | var updates: std.ArrayListUnmanaged(Update) = .{}; | 495 | var updates: std.ArrayListUnmanaged(Update) = .empty; |
| 496 | var changes: std.ArrayListUnmanaged(FullContents) = .{}; | 496 | var changes: std.ArrayListUnmanaged(FullContents) = .empty; |
| 497 | var target_query: ?[]const u8 = null; | 497 | var target_query: ?[]const u8 = null; |
| 498 | var it = std.mem.splitScalar(u8, bytes, '\n'); | 498 | var it = std.mem.splitScalar(u8, bytes, '\n'); |
| 499 | var line_n: usize = 1; | 499 | var line_n: usize = 1; |