diff options
| author | Martin Wickham <spexguy070@gmail.com> | 2021-06-03 15:39:26 -0500 |
|---|---|---|
| committer | Martin Wickham <spexguy070@gmail.com> | 2021-06-03 17:02:16 -0500 |
| commit | fc9430f56798a53f9393a697f4ccd6bf9981b970 (patch) | |
| tree | 69a1a3b359e970349f9466f85a370918d78b7217 /src/link.zig | |
| parent | 87dae0ce98fde1957a9290c22866b3101ce419d8 (diff) | |
| download | zig-fc9430f56798a53f9393a697f4ccd6bf9981b970.tar.gz zig-fc9430f56798a53f9393a697f4ccd6bf9981b970.zip | |
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
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 16 |
1 files changed, 8 insertions, 8 deletions
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)); |
