authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-17 16:36:44-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-17 16:37:04-05:00
log2bb05f0ee7d545af1de5269e9a0d3aac59eb3f12
tree08e71a9eecf479706dc269d854048326b29337c1
parentdebba652a3f5af76840517321d389a2ec98a88f4

Dwarf: fix data races by reading from ZIR


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

src/link/Dwarf.zig+7-18
......@@ -2277,12 +2277,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
22772277 => DW.ACCESS.private,
22782278 _ => if (decl_extra.name.isNamedTest(file.zir))
22792279 DW.ACCESS.private
2280 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2280 else if (decl_extra.flags.is_pub)
22812281 DW.ACCESS.public
2282 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2283 DW.ACCESS.private
22842282 else
2285 unreachable,
2283 DW.ACCESS.private,
22862284 },
22872285 };
22882286 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2326,12 +2324,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
23262324 => DW.ACCESS.private,
23272325 _ => if (decl_extra.name.isNamedTest(file.zir))
23282326 DW.ACCESS.private
2329 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2327 else if (decl_extra.flags.is_pub)
23302328 DW.ACCESS.public
2331 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2332 DW.ACCESS.private
23332329 else
2334 unreachable,
2330 DW.ACCESS.private,
23352331 },
23362332 };
23372333 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2373,12 +2369,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
23732369 => DW.ACCESS.private,
23742370 _ => if (decl_extra.name.isNamedTest(file.zir))
23752371 DW.ACCESS.private
2376 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2372 else if (decl_extra.flags.is_pub)
23772373 DW.ACCESS.public
2378 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2379 DW.ACCESS.private
23802374 else
2381 unreachable,
2375 DW.ACCESS.private,
23822376 },
23832377 };
23842378 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
......@@ -2624,12 +2618,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26242618 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
26252619 break :parent .{
26262620 parent_namespace_ptr.owner_type,
2627 if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))
2628 DW.ACCESS.public
2629 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2630 DW.ACCESS.private
2631 else
2632 unreachable,
2621 if (decl_extra.data.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private,
26332622 };
26342623 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
26352624