authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-05 17:00:10-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-05 17:00:10-07:00
log17067e0e6b6d28623b47b639853abc69a83b620a
tree6699eaf7624cf486158d4b0481b617c3b3320ae9
parent9b1aac8a654d1ee3515e2de8d477cf1909e63fdf

stage2: fix contents hash computation

during an incremental update change detection, the function call to get the old contents hash took place after mangling the old ZIR index, making it access the wrong array index.

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

src/Module.zig+1-1
...@@ -2436,6 +2436,7 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange...@@ -2436,6 +2436,7 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
2436 // Anonymous decls and the root decl have this set to 0. We still need2436 // Anonymous decls and the root decl have this set to 0. We still need
2437 // to walk them but we do not need to modify this value.2437 // to walk them but we do not need to modify this value.
2438 if (decl.zir_decl_index != 0) {2438 if (decl.zir_decl_index != 0) {
2439 const old_hash = decl.contentsHashZir(old_zir);
2439 decl.zir_decl_index = extra_map.get(decl.zir_decl_index) orelse {2440 decl.zir_decl_index = extra_map.get(decl.zir_decl_index) orelse {
2440 try deleted_decls.append(gpa, decl);2441 try deleted_decls.append(gpa, decl);
2441 continue;2442 continue;
...@@ -2446,7 +2447,6 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange...@@ -2446,7 +2447,6 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
2446 };2447 };
2447 decl.name = new_zir.nullTerminatedString(new_name_index).ptr;2448 decl.name = new_zir.nullTerminatedString(new_name_index).ptr;
24482449
2449 const old_hash = decl.contentsHashZir(old_zir);
2450 const new_hash = decl.contentsHashZir(new_zir);2450 const new_hash = decl.contentsHashZir(new_zir);
2451 if (!std.zig.srcHashEql(old_hash, new_hash)) {2451 if (!std.zig.srcHashEql(old_hash, new_hash)) {
2452 try outdated_decls.append(gpa, decl);2452 try outdated_decls.append(gpa, decl);