authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-03 11:47:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-03 15:31:29-07:00
log3ef9bd587987710591724448ddfe28288d3abff8
tree11a78e9bff7d17ad2f6958bd90ac20fa8d0b2470
parentf385522ab0d40a21303d3b40f963a3a466ec42e5

stage2: add the zig version to AstGen cache hash

This solves the problem of different versions of Zig having different binary representations of ZIR code. closes #9290

1 files changed, 2 insertions(+), 0 deletions(-)

src/Module.zig+2
...@@ -27,6 +27,7 @@ const trace = @import("tracy.zig").trace;...@@ -27,6 +27,7 @@ const trace = @import("tracy.zig").trace;
27const AstGen = @import("AstGen.zig");27const AstGen = @import("AstGen.zig");
28const Sema = @import("Sema.zig");28const Sema = @import("Sema.zig");
29const target_util = @import("target.zig");29const target_util = @import("target.zig");
30const build_options = @import("build_options");
3031
31/// General-purpose allocator. Used for both temporary and long-term storage.32/// General-purpose allocator. Used for both temporary and long-term storage.
32gpa: *Allocator,33gpa: *Allocator,
...@@ -2223,6 +2224,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File, prog_node: *std.Progress.Node...@@ -2223,6 +2224,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File, prog_node: *std.Progress.Node
2223 const want_local_cache = file.pkg == mod.root_pkg;2224 const want_local_cache = file.pkg == mod.root_pkg;
2224 const digest = hash: {2225 const digest = hash: {
2225 var path_hash: Cache.HashHelper = .{};2226 var path_hash: Cache.HashHelper = .{};
2227 path_hash.addBytes(build_options.version);
2226 if (!want_local_cache) {2228 if (!want_local_cache) {
2227 path_hash.addOptionalBytes(file.pkg.root_src_directory.path);2229 path_hash.addOptionalBytes(file.pkg.root_src_directory.path);
2228 }2230 }