zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 41eff5723dd61b19be88830f16d76514583e3339 (tree)
parent 46d592e485cf8ee4d85854040acd1b05271591b5
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 19 Jan 2024 22:18:04 -0700

Compilation: avoid caching root source file twice

The deleted lines here are redundant because they happen first thing
inside the function call below.

Additionally, skip hashing the root source file if it is an empty
string. I explored making this field along with `root` optional but
found this to be less messy actually.

Diffstat:
Msrc/Compilation.zig | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/Compilation.zig b/src/Compilation.zig @@ -1170,7 +1170,7 @@ fn addModuleTableToCacheHash( hash.addOptionalBytes(mod.root.root_dir.path); hash.addBytes(mod.root.sub_path); }, - .files => |man| { + .files => |man| if (mod.root_src_path.len != 0) { const pkg_zig_file = try mod.root.joinString(arena, mod.root_src_path); _ = try man.addFile(pkg_zig_file, null); }, @@ -2467,8 +2467,6 @@ fn addNonIncrementalStuffToCacheManifest( comptime assert(link_hash_implementation_version == 11); if (comp.module) |mod| { - const main_zig_file = try mod.main_mod.root.joinString(arena, mod.main_mod.root_src_path); - _ = try man.addFile(main_zig_file, null); try addModuleTableToCacheHash(gpa, arena, &man.hash, mod.root_mod, mod.main_mod, .{ .files = man }); // Synchronize with other matching comments: ZigOnlyHashStuff