| ... | ... | @@ -479,36 +479,39 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { |
| 479 | 479 | }; |
| 480 | 480 | if (!has_namespace) continue; |
| 481 | 481 | |
| 482 | | var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; |
| 482 | // Value is whether the declaration is `pub`. |
| 483 | var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, bool) = .empty; |
| 483 | 484 | defer old_names.deinit(zcu.gpa); |
| 484 | 485 | { |
| 485 | 486 | var it = old_zir.declIterator(old_inst); |
| 486 | 487 | while (it.next()) |decl_inst| { |
| 487 | | const name_zir = old_zir.getDeclaration(decl_inst).name; |
| 488 | | if (name_zir == .empty) continue; |
| 488 | const old_decl = old_zir.getDeclaration(decl_inst); |
| 489 | if (old_decl.name == .empty) continue; |
| 489 | 490 | const name_ip = try zcu.intern_pool.getOrPutString( |
| 490 | 491 | zcu.gpa, |
| 491 | 492 | pt.tid, |
| 492 | | old_zir.nullTerminatedString(name_zir), |
| 493 | old_zir.nullTerminatedString(old_decl.name), |
| 493 | 494 | .no_embedded_nulls, |
| 494 | 495 | ); |
| 495 | | try old_names.put(zcu.gpa, name_ip, {}); |
| 496 | try old_names.put(zcu.gpa, name_ip, old_decl.is_pub); |
| 496 | 497 | } |
| 497 | 498 | } |
| 498 | 499 | var any_change = false; |
| 499 | 500 | { |
| 500 | 501 | var it = new_zir.declIterator(new_inst); |
| 501 | 502 | while (it.next()) |decl_inst| { |
| 502 | | const name_zir = new_zir.getDeclaration(decl_inst).name; |
| 503 | | if (name_zir == .empty) continue; |
| 503 | const new_decl = new_zir.getDeclaration(decl_inst); |
| 504 | if (new_decl.name == .empty) continue; |
| 504 | 505 | const name_ip = try zcu.intern_pool.getOrPutString( |
| 505 | 506 | zcu.gpa, |
| 506 | 507 | pt.tid, |
| 507 | | new_zir.nullTerminatedString(name_zir), |
| 508 | new_zir.nullTerminatedString(new_decl.name), |
| 508 | 509 | .no_embedded_nulls, |
| 509 | 510 | ); |
| 510 | | if (old_names.swapRemove(name_ip)) continue; |
| 511 | | // Name added |
| 511 | if (old_names.fetchSwapRemove(name_ip)) |kv| { |
| 512 | if (kv.value == new_decl.is_pub) continue; |
| 513 | } |
| 514 | // Name added, or changed whether it's pub |
| 512 | 515 | any_change = true; |
| 513 | 516 | try zcu.markDependeeOutdated(.not_marked_po, .{ .namespace_name = .{ |
| 514 | 517 | .namespace = tracked_inst_index, |