From 8588964972acc473c09e21958a7e52247c978603 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 2 Sep 2024 22:32:21 +0100 Subject: Replace deprecated default initializations with decl literals --- src/codegen/spirv/Assembler.zig | 10 +++++----- src/codegen/spirv/Module.zig | 20 ++++++++++---------- src/codegen/spirv/Section.zig | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/codegen/spirv') diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 2cbb873d30..9e39f2ed09 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue); gpa: Allocator, /// A list of errors that occured during processing the assembly. -errors: std.ArrayListUnmanaged(ErrorMsg) = .{}, +errors: std.ArrayListUnmanaged(ErrorMsg) = .empty, /// The source code that is being assembled. src: []const u8, @@ -161,7 +161,7 @@ spv: *SpvModule, func: *SpvModule.Fn, /// `self.src` tokenized. -tokens: std.ArrayListUnmanaged(Token) = .{}, +tokens: std.ArrayListUnmanaged(Token) = .empty, /// The token that is next during parsing. current_token: u32 = 0, @@ -172,9 +172,9 @@ inst: struct { /// The opcode of the current instruction. opcode: Opcode = undefined, /// Operands of the current instruction. - operands: std.ArrayListUnmanaged(Operand) = .{}, + operands: std.ArrayListUnmanaged(Operand) = .empty, /// This is where string data resides. Strings are zero-terminated. - string_bytes: std.ArrayListUnmanaged(u8) = .{}, + string_bytes: std.ArrayListUnmanaged(u8) = .empty, /// Return a reference to the result of this instruction, if any. fn result(self: @This()) ?AsmValue.Ref { @@ -196,7 +196,7 @@ value_map: AsmValueMap = .{}, /// This set is used to quickly transform from an opcode name to the /// index in its instruction set. The index of the key is the /// index in `spec.InstructionSet.core.instructions()`. -instruction_map: std.StringArrayHashMapUnmanaged(void) = .{}, +instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty, /// Free the resources owned by this assembler. pub fn deinit(self: *Assembler) void { diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index ae30de156b..94787e06b9 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -35,7 +35,7 @@ pub const Fn = struct { /// the end of this function definition. body: Section = .{}, /// The decl dependencies that this function depends on. - decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{}, + decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty, /// Reset this function without deallocating resources, so that /// it may be used to emit code for another function. @@ -141,7 +141,7 @@ sections: struct { next_result_id: Word, /// Cache for results of OpString instructions. -strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, +strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty, /// Some types shouldn't be emitted more than one time, but cannot be caught by /// the `intern_map` during codegen. Sometimes, IDs are compared to check if @@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, cache: struct { bool_type: ?IdRef = null, void_type: ?IdRef = null, - int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{}, - float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{}, + int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty, + float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty, // This cache is required so that @Vector(X, u1) in direct representation has the // same ID as @Vector(X, bool) in indirect representation. - vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .{}, + vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .empty, - builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{}, + builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty, } = .{}, /// Set of Decls, referred to by Decl.Index. -decls: std.ArrayListUnmanaged(Decl) = .{}, +decls: std.ArrayListUnmanaged(Decl) = .empty, /// List of dependencies, per decl. This list holds all the dependencies, sliced by the /// begin_dep and end_dep in `self.decls`. -decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{}, +decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty, /// The list of entry points that should be exported from this module. -entry_points: std.ArrayListUnmanaged(EntryPoint) = .{}, +entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty, /// The list of extended instruction sets that should be imported. -extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{}, +extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty, pub fn init(gpa: Allocator) Module { return .{ diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index 20abf8ab70..1fdf884bdb 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -15,7 +15,7 @@ const Opcode = spec.Opcode; /// The instructions in this section. Memory is owned by the Module /// externally associated to this Section. -instructions: std.ArrayListUnmanaged(Word) = .{}, +instructions: std.ArrayListUnmanaged(Word) = .empty, pub fn deinit(section: *Section, allocator: Allocator) void { section.instructions.deinit(allocator); -- cgit v1.2.3