Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/langref/wasi_args.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const std = @import("std");

pub fn main() !void {
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
const gpa = general_purpose_allocator.allocator();
const args = try std.process.argsAlloc(gpa);
defer std.process.argsFree(gpa, args);
Expand Down
2 changes: 1 addition & 1 deletion doc/langref/wasi_preopens.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");
const fs = std.fs;

pub fn main() !void {
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
const gpa = general_purpose_allocator.allocator();

var arena_instance = std.heap.ArenaAllocator.init(gpa);
Expand Down
10 changes: 5 additions & 5 deletions lib/compiler/aro/aro/CodeGen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ node_tag: []const Tree.Tag,
node_data: []const Tree.Node.Data,
node_ty: []const Type,
wip_switch: *WipSwitch = undefined,
symbols: std.ArrayListUnmanaged(Symbol) = .{},
ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},
record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},
record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{},
symbols: std.ArrayListUnmanaged(Symbol) = .empty,
ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty,
record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty,
cond_dummy_ty: ?Interner.Ref = null,
bool_invert: bool = false,
bool_end_label: Ir.Ref = .none,
Expand Down
10 changes: 5 additions & 5 deletions lib/compiler/aro/aro/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ gpa: Allocator,
diagnostics: Diagnostics,

environment: Environment = .{},
sources: std.StringArrayHashMapUnmanaged(Source) = .{},
include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{},
sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
target: std.Target = @import("builtin").target,
pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},
pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
langopts: LangOpts = .{},
generated_buf: std.ArrayListUnmanaged(u8) = .{},
generated_buf: std.ArrayListUnmanaged(u8) = .empty,
builtins: Builtins = .{},
types: struct {
wchar: Type = undefined,
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/Diagnostics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub const Options = struct {

const Diagnostics = @This();

list: std.ArrayListUnmanaged(Message) = .{},
list: std.ArrayListUnmanaged(Message) = .empty,
arena: std.heap.ArenaAllocator,
fatal_errors: bool = false,
options: Options = .{},
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/aro/aro/Driver.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ pub const Linker = enum {
const Driver = @This();

comp: *Compilation,
inputs: std.ArrayListUnmanaged(Source) = .{},
link_objects: std.ArrayListUnmanaged([]const u8) = .{},
inputs: std.ArrayListUnmanaged(Source) = .empty,
link_objects: std.ArrayListUnmanaged([]const u8) = .empty,
output_name: ?[]const u8 = null,
sysroot: ?[]const u8 = null,
system_defines: Compilation.SystemDefinesMode = .include_system_defines,
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/aro/aro/Hideset.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ pub const Index = enum(u32) {
_,
};

map: std.AutoHashMapUnmanaged(Identifier, Index) = .{},
map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty,
/// Used for computing union/intersection of two lists; stored here so that allocations can be retained
/// until hideset is deinit'ed
tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{},
tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty,
linked_list: Item.List = .{},
comp: *const Compilation,

Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/InitList.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Item = struct {

const InitList = @This();

list: std.ArrayListUnmanaged(Item) = .{},
list: std.ArrayListUnmanaged(Item) = .empty,
node: NodeIndex = .none,
tok: TokenIndex = 0,

Expand Down
6 changes: 3 additions & 3 deletions lib/compiler/aro/aro/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ param_buf: std.ArrayList(Type.Func.Param),
enum_buf: std.ArrayList(Type.Enum.Field),
record_buf: std.ArrayList(Type.Record.Field),
attr_buf: std.MultiArrayList(TentativeAttribute) = .{},
attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{},
attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
field_attr_buf: std.ArrayList([]const Attribute),
/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
/// The key is the StringId of `Foo` and the value is the TokenIndex of `bar`
/// Items are removed if the type is subsequently completed with a definition.
/// We only store the first tentative definition that uses a given type because this map is only used
/// for issuing an error message, and correcting the first error for a type will fix all of them for that type.
tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{},
tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty,

// configuration and miscellaneous info
no_eval: bool = false,
Expand Down Expand Up @@ -174,7 +174,7 @@ record: struct {
}
}
} = .{},
record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty,
@"switch": ?*Switch = null,
in_loop: bool = false,
pragma_pack: ?u8 = null,
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/Preprocessor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ counter: u32 = 0,
expansion_source_loc: Source.Location = undefined,
poisoned_identifiers: std.StringHashMap(void),
/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},
include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,

/// Store `keyword_define` and `keyword_undef` tokens.
/// Used to implement preprocessor debug dump options
Expand Down
6 changes: 3 additions & 3 deletions lib/compiler/aro/aro/SymbolStack.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ pub const Kind = enum {
constexpr,
};

scopes: std.ArrayListUnmanaged(Scope) = .{},
scopes: std.ArrayListUnmanaged(Scope) = .empty,
/// allocations from nested scopes are retained after popping; `active_len` is the number
/// of currently-active items in `scopes`.
active_len: usize = 0,

const Scope = struct {
vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},
vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,

fn deinit(self: *Scope, allocator: Allocator) void {
self.vars.deinit(allocator);
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/pragmas/gcc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pragma: Pragma = .{
.preserveTokens = preserveTokens,
},
original_options: Diagnostics.Options = .{},
options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{},
options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .empty,

const Directive = enum {
warning,
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/pragmas/pack.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pragma: Pragma = .{
.parserHandler = parserHandler,
.preserveTokens = preserveTokens,
},
stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{},
stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .empty,

pub fn init(allocator: mem.Allocator) !*Pragma {
var pack = try allocator.create(Pack);
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/toolchains/Linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults");
const Linux = @This();

distro: Distro.Tag = .unknown,
extra_opts: std.ArrayListUnmanaged([]const u8) = .{},
extra_opts: std.ArrayListUnmanaged([]const u8) = .empty,
gcc_detector: GCCDetector = .{},

pub fn discover(self: *Linux, tc: *Toolchain) !void {
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/aro/backend/Interner.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;

const Interner = @This();

map: std.AutoArrayHashMapUnmanaged(void, void) = .{},
map: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
items: std.MultiArrayList(struct {
tag: Tag,
data: u32,
}) = .{},
extra: std.ArrayListUnmanaged(u32) = .{},
limbs: std.ArrayListUnmanaged(Limb) = .{},
strings: std.ArrayListUnmanaged(u8) = .{},
extra: std.ArrayListUnmanaged(u32) = .empty,
limbs: std.ArrayListUnmanaged(Limb) = .empty,
strings: std.ArrayListUnmanaged(u8) = .empty,

const KeyAdapter = struct {
interner: *const Interner,
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/aro/backend/Ir.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ pub const Builder = struct {
arena: std.heap.ArenaAllocator,
interner: *Interner,

decls: std.StringArrayHashMapUnmanaged(Decl) = .{},
decls: std.StringArrayHashMapUnmanaged(Decl) = .empty,
instructions: std.MultiArrayList(Ir.Inst) = .{},
body: std.ArrayListUnmanaged(Ref) = .{},
body: std.ArrayListUnmanaged(Ref) = .empty,
alloc_count: u32 = 0,
arg_count: u32 = 0,
current_label: Ref = undefined,
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/aro/backend/Object/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Object = @import("../Object.zig");

const Section = struct {
data: std.ArrayList(u8),
relocations: std.ArrayListUnmanaged(Relocation) = .{},
relocations: std.ArrayListUnmanaged(Relocation) = .empty,
flags: u64,
type: u32,
index: u16 = undefined,
Expand Down Expand Up @@ -37,9 +37,9 @@ const Elf = @This();

obj: Object,
/// The keys are owned by the Codegen.tree
sections: std.StringHashMapUnmanaged(*Section) = .{},
local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},
sections: std.StringHashMapUnmanaged(*Section) = .empty,
local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
unnamed_symbol_mangle: u32 = 0,
strtab_len: u64 = strtab_default.len,
arena: std.heap.ArenaAllocator,
Expand Down
16 changes: 8 additions & 8 deletions lib/compiler/aro_translate_c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ const Context = @This();

gpa: mem.Allocator,
arena: mem.Allocator,
decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{},
decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty,
alias_list: AliasList,
global_scope: *Scope.Root,
mangle_count: u32 = 0,
/// Table of record decls that have been demoted to opaques.
opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{},
opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty,
/// Table of unnamed enums and records that are child types of typedefs.
unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{},
unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty,
/// Needed to decide if we are parsing a typename
typedefs: std.StringArrayHashMapUnmanaged(void) = .{},
typedefs: std.StringArrayHashMapUnmanaged(void) = .empty,

/// This one is different than the root scope's name table. This contains
/// a list of names that we found by visiting all the top level decls without
/// translating them. The other maps are updated as we translate; this one is updated
/// up front in a pre-processing step.
global_names: std.StringArrayHashMapUnmanaged(void) = .{},
global_names: std.StringArrayHashMapUnmanaged(void) = .empty,

/// This is similar to `global_names`, but contains names which we would
/// *like* to use, but do not strictly *have* to if they are unavailable.
Expand All @@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{},
/// may be mangled.
/// This is distinct from `global_names` so we can detect at a type
/// declaration whether or not the name is available.
weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{},
weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty,

pattern_list: PatternList,
tree: Tree,
Expand Down Expand Up @@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_
}

fn getTypeStr(c: *Context, ty: Type) ![]const u8 {
var buf: std.ArrayListUnmanaged(u8) = .{};
var buf: std.ArrayListUnmanaged(u8) = .empty;
defer buf.deinit(c.gpa);
const w = buf.writer(c.gpa);
try ty.print(c.mapper, c.comp.langopts, w);
Expand Down Expand Up @@ -1793,7 +1793,7 @@ pub fn main() !void {
defer arena_instance.deinit();
const arena = arena_instance.allocator();

var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
const gpa = general_purpose_allocator.allocator();

const args = try std.process.argsAlloc(arena);
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/aro_translate_c/ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ const Context = struct {
gpa: Allocator,
buf: std.ArrayList(u8),
nodes: std.zig.Ast.NodeList = .{},
extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .{},
extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .empty,
tokens: std.zig.Ast.TokenList = .{},

fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex {
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/build_runner.zig
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ pub fn main() !void {
}

if (graph.needed_lazy_dependencies.entries.len != 0) {
var buffer: std.ArrayListUnmanaged(u8) = .{};
var buffer: std.ArrayListUnmanaged(u8) = .empty;
for (graph.needed_lazy_dependencies.keys()) |k| {
try buffer.appendSlice(arena, k);
try buffer.append(arena, '\n');
Expand Down Expand Up @@ -1173,7 +1173,7 @@ pub fn printErrorMessages(
// Provide context for where these error messages are coming from by
// printing the corresponding Step subtree.

var step_stack: std.ArrayListUnmanaged(*Step) = .{};
var step_stack: std.ArrayListUnmanaged(*Step) = .empty;
defer step_stack.deinit(gpa);
try step_stack.append(gpa, failing_step);
while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/objcopy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn main() !void {
defer arena_instance.deinit();
const arena = arena_instance.allocator();

var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
const gpa = general_purpose_allocator.allocator();

const args = try std.process.argsAlloc(arena);
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/reduce.zig
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub fn main() !void {
defer arena_instance.deinit();
const arena = arena_instance.allocator();

var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};
var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
const gpa = general_purpose_allocator.allocator();

const args = try std.process.argsAlloc(arena);
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn main() !void {
const root_source_file_path = opt_root_source_file_path orelse
fatal("missing root source file path argument; see -h for usage", .{});

var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .{};
var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .empty;
try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1);
interestingness_argv.appendAssumeCapacity(checker_path);
interestingness_argv.appendSliceAssumeCapacity(argv);
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/resinator/ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub const Tree = struct {
};

pub const CodePageLookup = struct {
lookup: std.ArrayListUnmanaged(CodePage) = .{},
lookup: std.ArrayListUnmanaged(CodePage) = .empty,
allocator: Allocator,
default_code_page: CodePage,

Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/resinator/cli.zig
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void {
}

pub const Diagnostics = struct {
errors: std.ArrayListUnmanaged(ErrorDetails) = .{},
errors: std.ArrayListUnmanaged(ErrorDetails) = .empty,
allocator: Allocator,

pub const ErrorDetails = struct {
arg_index: usize,
arg_span: ArgSpan = .{},
msg: std.ArrayListUnmanaged(u8) = .{},
msg: std.ArrayListUnmanaged(u8) = .empty,
type: Type = .err,
print_args: bool = true,

Expand Down Expand Up @@ -132,13 +132,13 @@ pub const Options = struct {
allocator: Allocator,
input_filename: []const u8 = &[_]u8{},
output_filename: []const u8 = &[_]u8{},
extra_include_paths: std.ArrayListUnmanaged([]const u8) = .{},
extra_include_paths: std.ArrayListUnmanaged([]const u8) = .empty,
ignore_include_env_var: bool = false,
preprocess: Preprocess = .yes,
default_language_id: ?u16 = null,
default_code_page: ?CodePage = null,
verbose: bool = false,
symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .{},
symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty,
null_terminate_string_table_strings: bool = false,
max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints,
silent_duplicate_control_ids: bool = false,
Expand Down
Loading