aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv
diff options
context:
space:
mode:
authorMatthew Lugg <mlugg@mlugg.co.uk>2024-09-12 19:50:38 +0100
committerGitHub <noreply@github.com>2024-09-12 19:50:38 +0100
commit0001f91e4e1e51cd64cdd5c0a21451c8bad67233 (patch)
tree9c3efb262890fa76a9b1d02c694dadad11c316f4 /src/codegen/spirv
parentb95e0e09dcbe4ca948fd4098a8e3a4d90df9cb22 (diff)
parent9271a89c65967ff0fed7011b4195abdd0f9195eb (diff)
downloadzig-0001f91e4e1e51cd64cdd5c0a21451c8bad67233.tar.gz
zig-0001f91e4e1e51cd64cdd5c0a21451c8bad67233.zip
Merge pull request #21287 from linusg/deprecated-default-init
Replace deprecated default initializations with decl literals
Diffstat (limited to 'src/codegen/spirv')
-rw-r--r--src/codegen/spirv/Assembler.zig10
-rw-r--r--src/codegen/spirv/Module.zig20
-rw-r--r--src/codegen/spirv/Section.zig2
3 files changed, 16 insertions, 16 deletions
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);