From 9c3324173de2d8de80e95fb6be23eb63dfbc5169 Mon Sep 17 00:00:00 2001 From: mlugg Date: Sat, 17 Aug 2024 11:38:19 +0100 Subject: [PATCH] compiler: merge conflicts and typos --- src/Sema.zig | 6 +++--- src/Zcu.zig | 2 +- src/link/Dwarf.zig | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index c4345c4464..7930c8f080 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2504,12 +2504,12 @@ pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Module.Error const mod = sema.pt.zcu; if (build_options.enable_debug_extensions and mod.comp.debug_compile_errors) { - var all_references = mod.resolveReferences() catch @panic("out of memory"); + var all_references: ?std.AutoHashMapUnmanaged(AnalUnit, ?Zcu.ResolvedReference) = null; var wip_errors: std.zig.ErrorBundle.Wip = undefined; wip_errors.init(gpa) catch @panic("out of memory"); - Compilation.addModuleErrorMsg(mod, &wip_errors, err_msg.*, &all_references) catch unreachable; + Compilation.addModuleErrorMsg(mod, &wip_errors, err_msg.*, &all_references) catch @panic("out of memory"); std.debug.print("compile error during Sema:\n", .{}); - var error_bundle = wip_errors.toOwnedBundle("") catch unreachable; + var error_bundle = wip_errors.toOwnedBundle("") catch @panic("out of memory"); error_bundle.renderToStdErr(.{ .ttyconf = .no_color }); crash_report.compilerPanic("unexpected compile error occurred", null, null); } diff --git a/src/Zcu.zig b/src/Zcu.zig index fc7978b15f..a47979bf60 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -2433,7 +2433,7 @@ pub fn findOutdatedToAnalyze(zcu: *Zcu) Allocator.Error!?AnalUnit { // Any units in `potentially_outdated` must just be stuck in loops with one another: none of those // units have had any outdated dependencies so far, and all of their remaining PO deps are triggered // by other units in `potentially_outdated`. So, we can safety assume those units up-to-date. - zcu.potentially_outdated.clear(); + zcu.potentially_outdated.clearRetainingCapacity(); log.debug("findOutdatedToAnalyze: no outdated depender", .{}); return null; } diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 5bc7ae5dc1..e6cf89a4ce 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -786,7 +786,7 @@ const Entry = struct { const ip = &zcu.intern_pool; for (dwarf.types.keys(), dwarf.types.values()) |ty, other_entry| { const ty_unit: Unit.Index = if (Type.fromInterned(ty).typeDeclInst(zcu)) |inst_index| - dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFull(ip).file).mod) catch unreachable + dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFile(ip)).mod) catch unreachable else .main; if (sec.getUnit(ty_unit) == unit and unit.getEntry(other_entry) == entry) @@ -796,7 +796,7 @@ const Entry = struct { }); } for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { - const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFull(ip).file).mod) catch unreachable; + const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod) catch unreachable; if (sec.getUnit(nav_unit) == unit and unit.getEntry(other_entry) == entry) log.err("missing Nav({}({d}))", .{ ip.getNav(nav).fqn.fmt(ip), @intFromEnum(nav) }); } @@ -1201,7 +1201,7 @@ pub const WipNav = struct { const ip = &zcu.intern_pool; const maybe_inst_index = ty.typeDeclInst(zcu); const unit = if (maybe_inst_index) |inst_index| - try wip_nav.dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFull(ip).file).mod) + try wip_nav.dwarf.getUnit(zcu.fileByIndex(inst_index.resolveFile(ip)).mod) else .main; const gop = try wip_nav.dwarf.types.getOrPut(wip_nav.dwarf.gpa, ty.toIntern()); @@ -1539,7 +1539,7 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In const nav = ip.getNav(nav_index); log.debug("initWipNav({})", .{nav.fqn.fmt(ip)}); - const inst_info = nav.srcInst(ip).resolveFull(ip); + const inst_info = nav.srcInst(ip).resolveFull(ip).?; const file = zcu.fileByIndex(inst_info.file); const unit = try dwarf.getUnit(file.mod); @@ -1874,7 +1874,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool const nav = ip.getNav(nav_index); log.debug("updateComptimeNav({})", .{nav.fqn.fmt(ip)}); - const inst_info = nav.srcInst(ip).resolveFull(ip); + const inst_info = nav.srcInst(ip).resolveFull(ip).?; const file = zcu.fileByIndex(inst_info.file); assert(file.zir_loaded); const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); @@ -1937,7 +1937,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool }; break :value_inst value_inst; }; - const type_inst_info = loaded_struct.zir_index.unwrap().?.resolveFull(ip); + const type_inst_info = loaded_struct.zir_index.unwrap().?.resolveFull(ip).?; if (type_inst_info.inst != value_inst) break :decl_struct; const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); @@ -2053,7 +2053,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool }; break :value_inst value_inst; }; - const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip); + const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?; if (type_inst_info.inst != value_inst) break :decl_enum; const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); @@ -2127,7 +2127,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool }; break :value_inst value_inst; }; - const type_inst_info = loaded_union.zir_index.resolveFull(ip); + const type_inst_info = loaded_union.zir_index.resolveFull(ip).?; if (type_inst_info.inst != value_inst) break :decl_union; const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); @@ -2240,7 +2240,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool }; break :value_inst value_inst; }; - const type_inst_info = loaded_opaque.zir_index.resolveFull(ip); + const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?; if (type_inst_info.inst != value_inst) break :decl_opaque; const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); @@ -2704,7 +2704,7 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP const ty = Type.fromInterned(type_index); log.debug("updateContainerType({}({d}))", .{ ty.fmt(pt), @intFromEnum(type_index) }); - const inst_info = ty.typeDeclInst(zcu).?.resolveFull(ip); + const inst_info = ty.typeDeclInst(zcu).?.resolveFull(ip).?; const file = zcu.fileByIndex(inst_info.file); if (inst_info.inst == .main_struct_inst) { const unit = try dwarf.getUnit(file.mod); @@ -2922,7 +2922,7 @@ pub fn updateNavLineNumber(dwarf: *Dwarf, zcu: *Zcu, nav_index: InternPool.Nav.I const ip = &zcu.intern_pool; const zir_index = ip.getCau(ip.getNav(nav_index).analysis_owner.unwrap() orelse return).zir_index; - const inst_info = zir_index.resolveFull(ip); + const inst_info = zir_index.resolveFull(ip).?; assert(inst_info.inst != .main_struct_inst); const file = zcu.fileByIndex(inst_info.file);