From fc9430f56798a53f9393a697f4ccd6bf9981b970 Mon Sep 17 00:00:00 2001 From: Martin Wickham Date: Thu, 3 Jun 2021 15:39:26 -0500 Subject: Breaking hash map changes for 0.8.0 - hash/eql functions moved into a Context object - *Context functions pass an explicit context - *Adapted functions pass specialized keys and contexts - new getPtr() function returns a pointer to value - remove functions renamed to fetchRemove - new remove functions return bool - removeAssertDiscard deleted, use assert(remove(...)) instead - Keys and values are stored in separate arrays - Entry is now {*K, *V}, the new KV is {K, V} - BufSet/BufMap functions renamed to match other set/map types - fixed iterating-while-modifying bug in src/link/C.zig --- src/link.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/link.zig') diff --git a/src/link.zig b/src/link.zig index 7338593a0e..fcb263f03e 100644 --- a/src/link.zig +++ b/src/link.zig @@ -162,7 +162,7 @@ pub const File = struct { }; /// For DWARF .debug_info. - pub const DbgInfoTypeRelocsTable = std.HashMapUnmanaged(Type, DbgInfoTypeReloc, Type.hash, Type.eql, std.hash_map.DefaultMaxLoadPercentage); + pub const DbgInfoTypeRelocsTable = std.HashMapUnmanaged(Type, DbgInfoTypeReloc, Type.HashContext, std.hash_map.default_max_load_percentage); /// For DWARF .debug_info. pub const DbgInfoTypeReloc = struct { @@ -406,8 +406,8 @@ pub const File = struct { const full_out_path = try emit.directory.join(comp.gpa, &[_][]const u8{emit.sub_path}); defer comp.gpa.free(full_out_path); assert(comp.c_object_table.count() == 1); - const the_entry = comp.c_object_table.items()[0]; - const cached_pp_file_path = the_entry.key.status.success.object_path; + const the_key = comp.c_object_table.keys()[0]; + const cached_pp_file_path = the_key.status.success.object_path; try fs.cwd().copyFile(cached_pp_file_path, fs.cwd(), full_out_path, .{}); return; } @@ -545,8 +545,8 @@ pub const File = struct { base.releaseLock(); try man.addListOfFiles(base.options.objects); - for (comp.c_object_table.items()) |entry| { - _ = try man.addFile(entry.key.status.success.object_path, null); + for (comp.c_object_table.keys()) |key| { + _ = try man.addFile(key.status.success.object_path, null); } try man.addOptionalFile(module_obj_path); try man.addOptionalFile(compiler_rt_path); @@ -580,12 +580,12 @@ pub const File = struct { var object_files = std.ArrayList([*:0]const u8).init(base.allocator); defer object_files.deinit(); - try object_files.ensureCapacity(base.options.objects.len + comp.c_object_table.items().len + 2); + try object_files.ensureCapacity(base.options.objects.len + comp.c_object_table.count() + 2); for (base.options.objects) |obj_path| { object_files.appendAssumeCapacity(try arena.dupeZ(u8, obj_path)); } - for (comp.c_object_table.items()) |entry| { - object_files.appendAssumeCapacity(try arena.dupeZ(u8, entry.key.status.success.object_path)); + for (comp.c_object_table.keys()) |key| { + object_files.appendAssumeCapacity(try arena.dupeZ(u8, key.status.success.object_path)); } if (module_obj_path) |p| { object_files.appendAssumeCapacity(try arena.dupeZ(u8, p)); -- cgit v1.2.3