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 11:47:58-07:00
log254a35fd8897ea705cd454d0e7f89036e78d0c60
tree12f76451fe621b746beda13ae611b2b99a70b937
parent5c34c01179a4a54c0fb11d107664f8c35e9f09dc

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,
...@@ -2235,6 +2236,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File) !void {...@@ -2235,6 +2236,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File) !void {
2235 const want_local_cache = file.pkg == mod.root_pkg;2236 const want_local_cache = file.pkg == mod.root_pkg;
2236 const digest = hash: {2237 const digest = hash: {
2237 var path_hash: Cache.HashHelper = .{};2238 var path_hash: Cache.HashHelper = .{};
2239 path_hash.addBytes(build_options.version);
2238 if (!want_local_cache) {2240 if (!want_local_cache) {
2239 path_hash.addOptionalBytes(file.pkg.root_src_directory.path);2241 path_hash.addOptionalBytes(file.pkg.root_src_directory.path);
2240 }2242 }