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