| ... | @@ -10,7 +10,7 @@ consts: std.ArrayList(Const), | ... | @@ -10,7 +10,7 @@ consts: std.ArrayList(Const), |
| 10 | globals: std.array_hash_map.Auto(InternPool.Nav.Index, Global), | 10 | globals: std.array_hash_map.Auto(InternPool.Nav.Index, Global), |
| 11 | funcs: std.array_hash_map.Auto(InternPool.Nav.Index, Func), | 11 | funcs: std.array_hash_map.Auto(InternPool.Nav.Index, Func), |
| 12 | decls: std.array_hash_map.Auto(InternPool.TrackedInst.Index, Decl), | 12 | decls: std.array_hash_map.Auto(InternPool.TrackedInst.Index, Decl), |
| 13 | pending_decl: struct { di: Decl.Index, instance_val: InternPool.Index }, | 13 | pending_decl: struct { di: Decl.Index, instance: Decl.Instance }, |
| 14 | | 14 | |
| 15 | debug_abbrev: Abbrev, | 15 | debug_abbrev: Abbrev, |
| 16 | frame: Frame, | 16 | frame: Frame, |
| ... | @@ -155,6 +155,12 @@ pub const Decl = struct { | ... | @@ -155,6 +155,12 @@ pub const Decl = struct { |
| 155 | return &dwarf.decls.values()[@backingInt(di)]; | 155 | return &dwarf.decls.values()[@backingInt(di)]; |
| 156 | } | 156 | } |
| 157 | }; | 157 | }; |
| | 158 | |
| | 159 | const Instance = union(enum) { |
| | 160 | none, |
| | 161 | @"const": InternPool.Index, |
| | 162 | global: InternPool.Nav.Index, |
| | 163 | }; |
| 158 | }; | 164 | }; |
| 159 | | 165 | |
| 160 | pub const Frame = struct { | 166 | pub const Frame = struct { |
| ... | @@ -1258,7 +1264,7 @@ pub fn init(lf: *link.File, format: DW.Format) Dwarf { | ... | @@ -1258,7 +1264,7 @@ pub fn init(lf: *link.File, format: DW.Format) Dwarf { |
| 1258 | .globals = .empty, | 1264 | .globals = .empty, |
| 1259 | .funcs = .empty, | 1265 | .funcs = .empty, |
| 1260 | .decls = .empty, | 1266 | .decls = .empty, |
| 1261 | .pending_decl = .{ .di = undefined, .instance_val = .none }, | 1267 | .pending_decl = .{ .di = undefined, .instance = .none }, |
| 1262 | | 1268 | |
| 1263 | .debug_abbrev = .{ | 1269 | .debug_abbrev = .{ |
| 1264 | .ni = .none, | 1270 | .ni = .none, |
| ... | @@ -1468,7 +1474,7 @@ pub fn getFuncIfExists(dwarf: *Dwarf, nav: InternPool.Nav.Index) ?Func.Index { | ... | @@ -1468,7 +1474,7 @@ pub fn getFuncIfExists(dwarf: *Dwarf, nav: InternPool.Nav.Index) ?Func.Index { |
| 1468 | return @fromBackingInt(@intCast(dwarf.funcs.getIndex(nav) orelse return null)); | 1474 | return @fromBackingInt(@intCast(dwarf.funcs.getIndex(nav) orelse return null)); |
| 1469 | } | 1475 | } |
| 1470 | | 1476 | |
| 1471 | fn getDeclInst(dwarf: *Dwarf, val: InternPool.Index) ?InternPool.TrackedInst.Index { | 1477 | fn getConstDeclInst(dwarf: *Dwarf, val: InternPool.Index) ?InternPool.TrackedInst.Index { |
| 1472 | const ip = &dwarf.lf.comp.zcu.?.intern_pool; | 1478 | const ip = &dwarf.lf.comp.zcu.?.intern_pool; |
| 1473 | switch (ip.indexToKey(val)) { | 1479 | switch (ip.indexToKey(val)) { |
| 1474 | else => unreachable, | 1480 | else => unreachable, |
| ... | @@ -1511,26 +1517,41 @@ fn getDeclInst(dwarf: *Dwarf, val: InternPool.Index) ?InternPool.TrackedInst.Ind | ... | @@ -1511,26 +1517,41 @@ fn getDeclInst(dwarf: *Dwarf, val: InternPool.Index) ?InternPool.TrackedInst.Ind |
| 1511 | }).srcInst(ip), | 1517 | }).srcInst(ip), |
| 1512 | } | 1518 | } |
| 1513 | } | 1519 | } |
| 1514 | pub fn getDecl( | 1520 | fn getConstDecl( |
| | 1521 | dwarf: *Dwarf, |
| | 1522 | pt: Zcu.PerThread, |
| | 1523 | instance_const: InternPool.Index, |
| | 1524 | ) link.Error!link.MappedFile.Node.Index { |
| | 1525 | return dwarf.getDecl(pt, dwarf.getConstDeclInst(instance_const) orelse { |
| | 1526 | const cpi = try dwarf.getConst(pt, .fromInterned(instance_const)); |
| | 1527 | return Const.get(cpi, dwarf).debug_info_ni.unwrap().?; |
| | 1528 | }, .{ .@"const" = instance_const }); |
| | 1529 | } |
| | 1530 | fn getGlobalDecl( |
| 1515 | dwarf: *Dwarf, | 1531 | dwarf: *Dwarf, |
| 1516 | pt: Zcu.PerThread, | 1532 | pt: Zcu.PerThread, |
| 1517 | instance_val: InternPool.Index, | 1533 | instance_global: InternPool.Nav.Index, |
| | 1534 | ) link.Error!link.MappedFile.Node.Index { |
| | 1535 | const ip = &pt.zcu.intern_pool; |
| | 1536 | return dwarf.getDecl(pt, ip.getNav(instance_global).srcInst(ip), .{ .global = instance_global }); |
| | 1537 | } |
| | 1538 | fn getDecl( |
| | 1539 | dwarf: *Dwarf, |
| | 1540 | pt: Zcu.PerThread, |
| | 1541 | inst: InternPool.TrackedInst.Index, |
| | 1542 | instance: Decl.Instance, |
| 1518 | ) link.Error!link.MappedFile.Node.Index { | 1543 | ) link.Error!link.MappedFile.Node.Index { |
| 1519 | const comp = dwarf.lf.comp; | 1544 | const comp = dwarf.lf.comp; |
| 1520 | const gpa = comp.gpa; | 1545 | const gpa = comp.gpa; |
| 1521 | const zcu = pt.zcu; | 1546 | const zcu = pt.zcu; |
| 1522 | const ip = &zcu.intern_pool; | 1547 | const ip = &zcu.intern_pool; |
| 1523 | const inst = dwarf.getDeclInst(instance_val) orelse { | | |
| 1524 | const cpi = try dwarf.getConst(pt, .fromInterned(instance_val)); | | |
| 1525 | return Const.get(cpi, dwarf).debug_info_ni.unwrap().?; | | |
| 1526 | }; | | |
| 1527 | const decl_gop = try dwarf.decls.getOrPut(gpa, inst); | 1548 | const decl_gop = try dwarf.decls.getOrPut(gpa, inst); |
| 1528 | if (!decl_gop.found_existing) decl_gop.value_ptr.* = .{ | 1549 | if (!decl_gop.found_existing) decl_gop.value_ptr.* = .{ |
| 1529 | .debug_info_ni = .none, | 1550 | .debug_info_ni = .none, |
| 1530 | }; | 1551 | }; |
| 1531 | const di: Decl.Index = @fromBackingInt(@intCast(decl_gop.index)); | 1552 | const di: Decl.Index = @fromBackingInt(@intCast(decl_gop.index)); |
| 1532 | if (decl_gop.value_ptr.debug_info_ni.unwrap()) |debug_info_ni| return debug_info_ni; | 1553 | if (decl_gop.value_ptr.debug_info_ni.unwrap()) |debug_info_ni| return debug_info_ni; |
| 1533 | dwarf.pending_decl = .{ .di = di, .instance_val = instance_val }; | 1554 | dwarf.pending_decl = .{ .di = di, .instance = instance }; |
| 1534 | const debug_info_ni = if (dwarf.lf.cast(.elf2)) |elf| debug_info_ni: { | 1555 | const debug_info_ni = if (dwarf.lf.cast(.elf2)) |elf| debug_info_ni: { |
| 1535 | try elf.nodes.ensureUnusedCapacity(gpa, 1); | 1556 | try elf.nodes.ensureUnusedCapacity(gpa, 1); |
| 1536 | try elf.dwarf_decls.putNoClobber(gpa, di, .{ | 1557 | try elf.dwarf_decls.putNoClobber(gpa, di, .{ |
| ... | @@ -1946,19 +1967,18 @@ pub fn genDebugRnglists( | ... | @@ -1946,19 +1967,18 @@ pub fn genDebugRnglists( |
| 1946 | try dr_w.writeByte(DW.RLE.end_of_list); | 1967 | try dr_w.writeByte(DW.RLE.end_of_list); |
| 1947 | } | 1968 | } |
| 1948 | | 1969 | |
| 1949 | pub fn updateComptimeNav( | 1970 | pub fn updateComptimeGlobal( |
| 1950 | dwarf: *Dwarf, | 1971 | dwarf: *Dwarf, |
| 1951 | pt: Zcu.PerThread, | 1972 | pt: Zcu.PerThread, |
| 1952 | ni: InternPool.Nav.Index, | 1973 | global: InternPool.Nav.Index, |
| 1953 | ) link.Error!void { | 1974 | ) link.Error!void { |
| 1954 | const zcu = pt.zcu; | 1975 | const zcu = pt.zcu; |
| 1955 | const ip = &zcu.intern_pool; | 1976 | const ip = &zcu.intern_pool; |
| 1956 | const nav = ip.getNav(ni); | 1977 | const nav = ip.getNav(global); |
| 1957 | log.debug("updateComptimeNav({f})", .{nav.fqn.fmt(ip)}); | 1978 | log.debug("updateComptimeNav({f})", .{nav.fqn.fmt(ip)}); |
| 1958 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 1979 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| 1959 | const nav_val: Value = .fromInterned(nav.resolved.?.value); | 1980 | const nav_val: Value = .fromInterned(nav.resolved.?.value); |
| 1960 | const zf = zcu.fileByIndex(inst_info.file); | 1981 | const decl = zcu.fileByIndex(inst_info.file).zir.?.getDeclaration(inst_info.inst); |
| 1961 | const decl = zf.zir.?.getDeclaration(inst_info.inst); | | |
| 1962 | switch (decl.kind) { | 1982 | switch (decl.kind) { |
| 1963 | .unnamed_test, .@"test", .decltest => return, | 1983 | .unnamed_test, .@"test", .decltest => return, |
| 1964 | .@"comptime", .@"const", .@"var" => {}, | 1984 | .@"comptime", .@"const", .@"var" => {}, |
| ... | @@ -1977,34 +1997,34 @@ pub fn updateComptimeNav( | ... | @@ -1977,34 +1997,34 @@ pub fn updateComptimeNav( |
| 1977 | .error_set_type, | 1997 | .error_set_type, |
| 1978 | .inferred_error_set_type, | 1998 | .inferred_error_set_type, |
| 1979 | .spirv_type, | 1999 | .spirv_type, |
| 1980 | => try dwarf.genDeclType(pt, ni, &decl), | 2000 | => try dwarf.genDeclType(pt, global, &decl), |
| 1981 | .struct_type => { | 2001 | .struct_type => { |
| 1982 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); | 2002 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); |
| 1983 | if (ni.toOptional() == loaded_struct.name_nav) | 2003 | if (global.toOptional() == loaded_struct.name_nav) |
| 1984 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) | 2004 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) |
| 1985 | else | 2005 | else |
| 1986 | try dwarf.genDeclType(pt, ni, &decl); | 2006 | try dwarf.genDeclType(pt, global, &decl); |
| 1987 | }, | 2007 | }, |
| 1988 | .enum_type => { | 2008 | .enum_type => { |
| 1989 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); | 2009 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); |
| 1990 | if (ni.toOptional() == loaded_enum.name_nav) | 2010 | if (global.toOptional() == loaded_enum.name_nav) |
| 1991 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) | 2011 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) |
| 1992 | else | 2012 | else |
| 1993 | try dwarf.genDeclType(pt, ni, &decl); | 2013 | try dwarf.genDeclType(pt, global, &decl); |
| 1994 | }, | 2014 | }, |
| 1995 | .union_type => { | 2015 | .union_type => { |
| 1996 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); | 2016 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); |
| 1997 | if (ni.toOptional() == loaded_union.name_nav) | 2017 | if (global.toOptional() == loaded_union.name_nav) |
| 1998 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) | 2018 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) |
| 1999 | else | 2019 | else |
| 2000 | try dwarf.genDeclType(pt, ni, &decl); | 2020 | try dwarf.genDeclType(pt, global, &decl); |
| 2001 | }, | 2021 | }, |
| 2002 | .opaque_type => { | 2022 | .opaque_type => { |
| 2003 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); | 2023 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); |
| 2004 | if (ni.toOptional() == loaded_opaque.name_nav) | 2024 | if (global.toOptional() == loaded_opaque.name_nav) |
| 2005 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) | 2025 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()) |
| 2006 | else | 2026 | else |
| 2007 | try dwarf.genDeclType(pt, ni, &decl); | 2027 | try dwarf.genDeclType(pt, global, &decl); |
| 2008 | }, | 2028 | }, |
| 2009 | .undef, | 2029 | .undef, |
| 2010 | .simple_value, | 2030 | .simple_value, |
| ... | @@ -2020,9 +2040,9 @@ pub fn updateComptimeNav( | ... | @@ -2020,9 +2040,9 @@ pub fn updateComptimeNav( |
| 2020 | .aggregate, | 2040 | .aggregate, |
| 2021 | .un, | 2041 | .un, |
| 2022 | .bitpack, | 2042 | .bitpack, |
| 2023 | => try dwarf.genDeclValue(pt, ni, &decl), | 2043 | => try dwarf.genDeclGlobal(pt, global, &decl), |
| 2024 | .@"extern" => unreachable, | 2044 | .@"extern" => unreachable, |
| 2025 | .func => |func| if (func.owner_nav == ni and func.generic_owner == .none) { | 2045 | .func => |func| if (func.owner_nav == global and func.generic_owner == .none) { |
| 2026 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | 2046 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); |
| 2027 | break :done; | 2047 | break :done; |
| 2028 | } else return, | 2048 | } else return, |
| ... | @@ -2034,10 +2054,10 @@ pub fn updateComptimeNav( | ... | @@ -2034,10 +2054,10 @@ pub fn updateComptimeNav( |
| 2034 | fn genDeclType( | 2054 | fn genDeclType( |
| 2035 | dwarf: *Dwarf, | 2055 | dwarf: *Dwarf, |
| 2036 | pt: Zcu.PerThread, | 2056 | pt: Zcu.PerThread, |
| 2037 | ni: InternPool.Nav.Index, | 2057 | global: InternPool.Nav.Index, |
| 2038 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, | 2058 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, |
| 2039 | ) link.Error!void { | 2059 | ) link.Error!void { |
| 2040 | const gi = try dwarf.getGlobal(ni); | 2060 | const gi = try dwarf.getGlobal(global); |
| 2041 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; | 2061 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; |
| 2042 | var di_nw: link.MappedFile.Node.Writer = undefined; | 2062 | var di_nw: link.MappedFile.Node.Writer = undefined; |
| 2043 | if (dwarf.lf.cast(.elf2)) |elf| { | 2063 | if (dwarf.lf.cast(.elf2)) |elf| { |
| ... | @@ -2045,7 +2065,7 @@ fn genDeclType( | ... | @@ -2045,7 +2065,7 @@ fn genDeclType( |
| 2045 | elf.resetNodeRelocs(debug_info_ni); | 2065 | elf.resetNodeRelocs(debug_info_ni); |
| 2046 | } else unreachable; | 2066 | } else unreachable; |
| 2047 | defer di_nw.deinit(); | 2067 | defer di_nw.deinit(); |
| 2048 | dwarf.genDeclTypeInner(pt, &di_nw, ni, decl) catch |err| switch (err) { | 2068 | dwarf.genDeclTypeInner(pt, &di_nw, global, decl) catch |err| switch (err) { |
| 2049 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), | 2069 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), |
| 2050 | else => |e| return e, | 2070 | else => |e| return e, |
| 2051 | }; | 2071 | }; |
| ... | @@ -2054,30 +2074,38 @@ fn genDeclTypeInner( | ... | @@ -2054,30 +2074,38 @@ fn genDeclTypeInner( |
| 2054 | dwarf: *Dwarf, | 2074 | dwarf: *Dwarf, |
| 2055 | pt: Zcu.PerThread, | 2075 | pt: Zcu.PerThread, |
| 2056 | di_nw: *link.MappedFile.Node.Writer, | 2076 | di_nw: *link.MappedFile.Node.Writer, |
| 2057 | ni: InternPool.Nav.Index, | 2077 | global: InternPool.Nav.Index, |
| 2058 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, | 2078 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, |
| 2059 | ) link.EmitError!void { | 2079 | ) link.EmitError!void { |
| 2060 | const ip = &pt.zcu.intern_pool; | 2080 | const zcu = pt.zcu; |
| 2061 | const nav = ip.getNav(ni); | 2081 | const ip = &zcu.intern_pool; |
| 2062 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(nav.analysis.?.namespace).owner_type); | 2082 | const nav = ip.getNav(global); |
| | 2083 | const parent_ty = ip.namespacePtr(nav.analysis.?.namespace).owner_type; |
| 2063 | const di_w = &di_nw.interface; | 2084 | const di_w = &di_nw.interface; |
| 2064 | try dwarf.abbrevCode(di_nw, .decl_type); | 2085 | if (Type.fromInterned(parent_ty).getCaptures(zcu).len > 0) { |
| 2065 | try dwarf.secOffset(di_nw, parent_ni, 0); | 2086 | try dwarf.abbrevCode(di_nw, .decl_instance_type); |
| 2066 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); | 2087 | try dwarf.refType(pt, di_nw, .fromInterned(parent_ty)); |
| 2067 | try di_w.writeUleb128(decl.src_column + 1); | 2088 | try dwarf.secOffset(di_nw, try dwarf.getGlobalDecl(pt, global), 0); |
| 2068 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); | 2089 | } else { |
| 2069 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); | 2090 | const parent_ni = try dwarf.getConstDecl(pt, parent_ty); |
| | 2091 | try dwarf.abbrevCode(di_nw, .decl_type); |
| | 2092 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| | 2093 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| | 2094 | try di_w.writeUleb128(decl.src_column + 1); |
| | 2095 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| | 2096 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); |
| | 2097 | } |
| 2070 | try dwarf.refConst(pt, di_nw, .fromInterned(nav.resolved.?.value)); | 2098 | try dwarf.refConst(pt, di_nw, .fromInterned(nav.resolved.?.value)); |
| 2071 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); | 2099 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); |
| 2072 | } | 2100 | } |
| 2073 | | 2101 | |
| 2074 | fn genDeclValue( | 2102 | fn genDeclGlobal( |
| 2075 | dwarf: *Dwarf, | 2103 | dwarf: *Dwarf, |
| 2076 | pt: Zcu.PerThread, | 2104 | pt: Zcu.PerThread, |
| 2077 | ni: InternPool.Nav.Index, | 2105 | global: InternPool.Nav.Index, |
| 2078 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, | 2106 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, |
| 2079 | ) link.Error!void { | 2107 | ) link.Error!void { |
| 2080 | const gi = try dwarf.getGlobal(ni); | 2108 | const gi = try dwarf.getGlobal(global); |
| 2081 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; | 2109 | const debug_info_ni = gi.get(dwarf).debug_info_ni.unwrap().?; |
| 2082 | var di_nw: link.MappedFile.Node.Writer = undefined; | 2110 | var di_nw: link.MappedFile.Node.Writer = undefined; |
| 2083 | if (dwarf.lf.cast(.elf2)) |elf| { | 2111 | if (dwarf.lf.cast(.elf2)) |elf| { |
| ... | @@ -2085,21 +2113,21 @@ fn genDeclValue( | ... | @@ -2085,21 +2113,21 @@ fn genDeclValue( |
| 2085 | elf.resetNodeRelocs(debug_info_ni); | 2113 | elf.resetNodeRelocs(debug_info_ni); |
| 2086 | } else unreachable; | 2114 | } else unreachable; |
| 2087 | defer di_nw.deinit(); | 2115 | defer di_nw.deinit(); |
| 2088 | dwarf.genDeclValueInner(pt, &di_nw, ni, decl) catch |err| switch (err) { | 2116 | dwarf.genDeclGlobalInner(pt, &di_nw, global, decl) catch |err| switch (err) { |
| 2089 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), | 2117 | error.WriteFailed => return dwarf.reportWriteError(&di_nw), |
| 2090 | else => |e| return e, | 2118 | else => |e| return e, |
| 2091 | }; | 2119 | }; |
| 2092 | } | 2120 | } |
| 2093 | fn genDeclValueInner( | 2121 | fn genDeclGlobalInner( |
| 2094 | dwarf: *Dwarf, | 2122 | dwarf: *Dwarf, |
| 2095 | pt: Zcu.PerThread, | 2123 | pt: Zcu.PerThread, |
| 2096 | di_nw: *link.MappedFile.Node.Writer, | 2124 | di_nw: *link.MappedFile.Node.Writer, |
| 2097 | ni: InternPool.Nav.Index, | 2125 | global: InternPool.Nav.Index, |
| 2098 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, | 2126 | decl: *const std.zig.Zir.Inst.Declaration.Unwrapped, |
| 2099 | ) link.EmitError!void { | 2127 | ) link.EmitError!void { |
| 2100 | const zcu = pt.zcu; | 2128 | const zcu = pt.zcu; |
| 2101 | const ip = &zcu.intern_pool; | 2129 | const ip = &zcu.intern_pool; |
| 2102 | const nav = ip.getNav(ni); | 2130 | const nav = ip.getNav(global); |
| 2103 | const nav_const, const nav_ty: Type, const nav_align, const nav_val: Value = resolved: { | 2131 | const nav_const, const nav_ty: Type, const nav_align, const nav_val: Value = resolved: { |
| 2104 | const resolved = nav.resolved.?; | 2132 | const resolved = nav.resolved.?; |
| 2105 | break :resolved .{ | 2133 | break :resolved .{ |
| ... | @@ -2110,7 +2138,7 @@ fn genDeclValueInner( | ... | @@ -2110,7 +2138,7 @@ fn genDeclValueInner( |
| 2110 | }; | 2138 | }; |
| 2111 | }; | 2139 | }; |
| 2112 | const nav_class = nav_ty.classify(zcu); | 2140 | const nav_class = nav_ty.classify(zcu); |
| 2113 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(nav.analysis.?.namespace).owner_type); | 2141 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr(nav.analysis.?.namespace).owner_type); |
| 2114 | const di_w = &di_nw.interface; | 2142 | const di_w = &di_nw.interface; |
| 2115 | try dwarf.abbrevCode(di_nw, if (nav_const) switch (nav_class) { | 2143 | try dwarf.abbrevCode(di_nw, if (nav_const) switch (nav_class) { |
| 2116 | .no_possible_value, .one_possible_value => .decl_const, | 2144 | .no_possible_value, .one_possible_value => .decl_const, |
| ... | @@ -2589,12 +2617,13 @@ fn updateConstInner( | ... | @@ -2589,12 +2617,13 @@ fn updateConstInner( |
| 2589 | .auto, .@"extern" => .decl_instance_empty_struct, | 2617 | .auto, .@"extern" => .decl_instance_empty_struct, |
| 2590 | .@"packed" => .decl_instance_empty_packed_struct, | 2618 | .@"packed" => .decl_instance_empty_packed_struct, |
| 2591 | }); | 2619 | }); |
| 2592 | try dwarf.secOffset(di_nw, try dwarf.getDecl(pt, val), 0); | 2620 | try dwarf.secOffset(di_nw, try dwarf.getConstDecl(pt, val), 0); |
| 2593 | } else if (loaded_struct.name_nav.unwrap()) |name_ni| { | 2621 | } else if (loaded_struct.name_nav.unwrap()) |name_ni| { |
| 2594 | const name_nav = ip.getNav(name_ni); | 2622 | const name_nav = ip.getNav(name_ni); |
| 2595 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); | 2623 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); |
| 2596 | const parent_ni = | 2624 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2597 | try dwarf.getDecl(pt, ip.namespacePtr(name_nav.analysis.?.namespace).owner_type); | 2625 | name_nav.analysis.?.namespace, |
| | 2626 | ).owner_type); |
| 2598 | try dwarf.abbrevCode(di_nw, if (loaded_struct.field_types.len > 0) | 2627 | try dwarf.abbrevCode(di_nw, if (loaded_struct.field_types.len > 0) |
| 2599 | switch (loaded_struct.layout) { | 2628 | switch (loaded_struct.layout) { |
| 2600 | .auto, .@"extern" => .decl_struct, | 2629 | .auto, .@"extern" => .decl_struct, |
| ... | @@ -2611,7 +2640,7 @@ fn updateConstInner( | ... | @@ -2611,7 +2640,7 @@ fn updateConstInner( |
| 2611 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); | 2640 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); |
| 2612 | } else { | 2641 | } else { |
| 2613 | const decl = zf.zir.?.getStructDecl(src_inst.inst); | 2642 | const decl = zf.zir.?.getStructDecl(src_inst.inst); |
| 2614 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | 2643 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2615 | ip.namespacePtr(loaded_struct.namespace).parent.unwrap().?, | 2644 | ip.namespacePtr(loaded_struct.namespace).parent.unwrap().?, |
| 2616 | ).owner_type); | 2645 | ).owner_type); |
| 2617 | try dwarf.abbrevCode(di_nw, if (loaded_struct.field_types.len > 0) | 2646 | try dwarf.abbrevCode(di_nw, if (loaded_struct.field_types.len > 0) |
| ... | @@ -2721,12 +2750,13 @@ fn updateConstInner( | ... | @@ -2721,12 +2750,13 @@ fn updateConstInner( |
| 2721 | .auto, .@"extern" => .decl_instance_empty_union, | 2750 | .auto, .@"extern" => .decl_instance_empty_union, |
| 2722 | .@"packed" => .decl_instance_empty_packed_union, | 2751 | .@"packed" => .decl_instance_empty_packed_union, |
| 2723 | }); | 2752 | }); |
| 2724 | try dwarf.secOffset(di_nw, try dwarf.getDecl(pt, val), 0); | 2753 | try dwarf.secOffset(di_nw, try dwarf.getConstDecl(pt, val), 0); |
| 2725 | } else if (loaded_union.name_nav.unwrap()) |name_ni| { | 2754 | } else if (loaded_union.name_nav.unwrap()) |name_ni| { |
| 2726 | const name_nav = ip.getNav(name_ni); | 2755 | const name_nav = ip.getNav(name_ni); |
| 2727 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); | 2756 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); |
| 2728 | const parent_ni = | 2757 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2729 | try dwarf.getDecl(pt, ip.namespacePtr(name_nav.analysis.?.namespace).owner_type); | 2758 | name_nav.analysis.?.namespace, |
| | 2759 | ).owner_type); |
| 2730 | try dwarf.abbrevCode(di_nw, if (loaded_union.field_types.len > 0) | 2760 | try dwarf.abbrevCode(di_nw, if (loaded_union.field_types.len > 0) |
| 2731 | switch (loaded_union.layout) { | 2761 | switch (loaded_union.layout) { |
| 2732 | .auto, .@"extern" => .decl_union, | 2762 | .auto, .@"extern" => .decl_union, |
| ... | @@ -2743,7 +2773,7 @@ fn updateConstInner( | ... | @@ -2743,7 +2773,7 @@ fn updateConstInner( |
| 2743 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); | 2773 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); |
| 2744 | } else { | 2774 | } else { |
| 2745 | const decl = zf.zir.?.getUnionDecl(loaded_union.zir_index.resolve(ip).?); | 2775 | const decl = zf.zir.?.getUnionDecl(loaded_union.zir_index.resolve(ip).?); |
| 2746 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | 2776 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2747 | ip.namespacePtr(loaded_union.namespace).parent.unwrap().?, | 2777 | ip.namespacePtr(loaded_union.namespace).parent.unwrap().?, |
| 2748 | ).owner_type); | 2778 | ).owner_type); |
| 2749 | try dwarf.abbrevCode(di_nw, if (loaded_union.field_types.len > 0) | 2779 | try dwarf.abbrevCode(di_nw, if (loaded_union.field_types.len > 0) |
| ... | @@ -2853,11 +2883,11 @@ fn updateConstInner( | ... | @@ -2853,11 +2883,11 @@ fn updateConstInner( |
| 2853 | .decl_instance_enum | 2883 | .decl_instance_enum |
| 2854 | else | 2884 | else |
| 2855 | .decl_instance_empty_enum); | 2885 | .decl_instance_empty_enum); |
| 2856 | try dwarf.secOffset(di_nw, try dwarf.getDecl(pt, val), 0); | 2886 | try dwarf.secOffset(di_nw, try dwarf.getConstDecl(pt, val), 0); |
| 2857 | } else if (loaded_enum.name_nav.unwrap()) |name_ni| { | 2887 | } else if (loaded_enum.name_nav.unwrap()) |name_ni| { |
| 2858 | const name_nav = ip.getNav(name_ni); | 2888 | const name_nav = ip.getNav(name_ni); |
| 2859 | const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); | 2889 | const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); |
| 2860 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | 2890 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2861 | name_nav.analysis.?.namespace, | 2891 | name_nav.analysis.?.namespace, |
| 2862 | ).owner_type); | 2892 | ).owner_type); |
| 2863 | try dwarf.abbrevCode( | 2893 | try dwarf.abbrevCode( |
| ... | @@ -2871,7 +2901,7 @@ fn updateConstInner( | ... | @@ -2871,7 +2901,7 @@ fn updateConstInner( |
| 2871 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); | 2901 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); |
| 2872 | } else { | 2902 | } else { |
| 2873 | const decl = zir.getEnumDecl(loaded_enum.zir_index.unwrap().?.resolve(ip).?); | 2903 | const decl = zir.getEnumDecl(loaded_enum.zir_index.unwrap().?.resolve(ip).?); |
| 2874 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | 2904 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 2875 | ip.namespacePtr(loaded_enum.namespace).parent.unwrap().?, | 2905 | ip.namespacePtr(loaded_enum.namespace).parent.unwrap().?, |
| 2876 | ).owner_type); | 2906 | ).owner_type); |
| 2877 | try dwarf.abbrevCode(di_nw, if (loaded_enum.field_names.len > 0) | 2907 | try dwarf.abbrevCode(di_nw, if (loaded_enum.field_names.len > 0) |
| ... | @@ -3036,8 +3066,7 @@ fn updateConstInner( | ... | @@ -3036,8 +3066,7 @@ fn updateConstInner( |
| 3036 | const func_type = ip.indexToKey(func.ty).func_type; | 3066 | const func_type = ip.indexToKey(func.ty).func_type; |
| 3037 | const nav = ip.getNav(func.owner_nav); | 3067 | const nav = ip.getNav(func.owner_nav); |
| 3038 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; | 3068 | const inst_info = nav.srcInst(ip).resolveFull(ip).?; |
| 3039 | const zf = zcu.fileByIndex(inst_info.file); | 3069 | const zir = &zcu.fileByIndex(inst_info.file).zir.?; |
| 3040 | const zir = &zf.zir.?; | | |
| 3041 | const decl = zir.getDeclaration(inst_info.inst); | 3070 | const decl = zir.getDeclaration(inst_info.inst); |
| 3042 | const empty = func_type.param_types.len == 0 and !func_type.is_var_args; | 3071 | const empty = func_type.param_types.len == 0 and !func_type.is_var_args; |
| 3043 | const parent_ty: Type = .fromInterned(ip.namespacePtr(nav.analysis.?.namespace).owner_type); | 3072 | const parent_ty: Type = .fromInterned(ip.namespacePtr(nav.analysis.?.namespace).owner_type); |
| ... | @@ -3268,12 +3297,12 @@ fn updateConstIncompleteInner( | ... | @@ -3268,12 +3297,12 @@ fn updateConstIncompleteInner( |
| 3268 | .@"union" => .decl_instance_empty_incomplete_union, | 3297 | .@"union" => .decl_instance_empty_incomplete_union, |
| 3269 | .@"enum" => .decl_instance_empty_incomplete_enum, | 3298 | .@"enum" => .decl_instance_empty_incomplete_enum, |
| 3270 | }); | 3299 | }); |
| 3271 | try dwarf.secOffset(di_nw, try dwarf.getDecl(pt, val), 0); | 3300 | try dwarf.secOffset(di_nw, try dwarf.getConstDecl(pt, val), 0); |
| 3272 | } else if (maybe_name_nav.unwrap()) |name_ni| { | 3301 | } else if (maybe_name_nav.unwrap()) |name_ni| { |
| 3273 | const name_nav = ip.getNav(name_ni); | 3302 | const name_nav = ip.getNav(name_ni); |
| 3274 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); | 3303 | const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); |
| 3275 | const parent_ni = | 3304 | const parent_ni = |
| 3276 | try dwarf.getDecl(pt, ip.namespacePtr(name_nav.analysis.?.namespace).owner_type); | 3305 | try dwarf.getConstDecl(pt, ip.namespacePtr(name_nav.analysis.?.namespace).owner_type); |
| 3277 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { | 3306 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { |
| 3278 | .@"struct" => .decl_incomplete_struct, | 3307 | .@"struct" => .decl_incomplete_struct, |
| 3279 | .@"union" => .decl_incomplete_union, | 3308 | .@"union" => .decl_incomplete_union, |
| ... | @@ -3289,7 +3318,7 @@ fn updateConstIncompleteInner( | ... | @@ -3289,7 +3318,7 @@ fn updateConstIncompleteInner( |
| 3289 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); | 3318 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| 3290 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); | 3319 | try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip)); |
| 3291 | } else { | 3320 | } else { |
| 3292 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | 3321 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 3293 | ip.namespacePtr(namespace).parent.unwrap().?, | 3322 | ip.namespacePtr(namespace).parent.unwrap().?, |
| 3294 | ).owner_type); | 3323 | ).owner_type); |
| 3295 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { | 3324 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { |
| ... | @@ -3360,10 +3389,16 @@ pub fn genDecl( | ... | @@ -3360,10 +3389,16 @@ pub fn genDecl( |
| 3360 | dwarf: *Dwarf, | 3389 | dwarf: *Dwarf, |
| 3361 | pt: Zcu.PerThread, | 3390 | pt: Zcu.PerThread, |
| 3362 | di_nw: *link.MappedFile.Node.Writer, | 3391 | di_nw: *link.MappedFile.Node.Writer, |
| 3363 | instance_val: InternPool.Index, | 3392 | instance: Decl.Instance, |
| 3364 | ) link.Error!void { | 3393 | ) link.Error!void { |
| 3365 | log.debug("genDecl({f})", .{Value.fromInterned(instance_val).fmtValue(pt)}); | 3394 | switch (instance) { |
| 3366 | dwarf.genDeclInner(pt, di_nw, instance_val) catch |err| switch (err) { | 3395 | .none => unreachable, |
| | 3396 | .@"const" => |@"const"| log.debug("genDecl({f})", .{Value.fromInterned(@"const").fmtValue(pt)}), |
| | 3397 | .global => |global| log.debug("genDecl({f})", .{ |
| | 3398 | pt.zcu.intern_pool.getNav(global).fqn.fmt(&pt.zcu.intern_pool), |
| | 3399 | }), |
| | 3400 | } |
| | 3401 | dwarf.genDeclInner(pt, di_nw, instance) catch |err| switch (err) { |
| 3367 | else => |e| return e, | 3402 | else => |e| return e, |
| 3368 | error.WriteFailed => return dwarf.reportWriteError(di_nw), | 3403 | error.WriteFailed => return dwarf.reportWriteError(di_nw), |
| 3369 | }; | 3404 | }; |
| ... | @@ -3372,218 +3407,239 @@ fn genDeclInner( | ... | @@ -3372,218 +3407,239 @@ fn genDeclInner( |
| 3372 | dwarf: *Dwarf, | 3407 | dwarf: *Dwarf, |
| 3373 | pt: Zcu.PerThread, | 3408 | pt: Zcu.PerThread, |
| 3374 | di_nw: *link.MappedFile.Node.Writer, | 3409 | di_nw: *link.MappedFile.Node.Writer, |
| 3375 | instance_val: InternPool.Index, | 3410 | instance: Decl.Instance, |
| 3376 | ) link.EmitError!void { | 3411 | ) link.EmitError!void { |
| 3377 | const zcu = pt.zcu; | 3412 | const zcu = pt.zcu; |
| 3378 | const ip = &zcu.intern_pool; | 3413 | const ip = &zcu.intern_pool; |
| 3379 | const di_w = &di_nw.interface; | 3414 | const di_w = &di_nw.interface; |
| 3380 | done: { | 3415 | done: switch (instance) { |
| 3381 | const kind: enum { @"struct", @"union", @"enum" }, const zf, const src_line, const src_column, const capture_names, const captures, const name, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(instance_val)) { | 3416 | .none => unreachable, |
| 3382 | else => unreachable, | 3417 | .@"const" => |@"const"| { |
| 3383 | .struct_type => { | 3418 | const kind: enum { @"struct", @"union", @"enum" }, const zf, const src_line, const src_column, const capture_names, const captures, const name, const maybe_name_nav, const namespace = container: switch (ip.indexToKey(instance.@"const")) { |
| 3384 | const loaded_struct = ip.loadStructType(instance_val); | 3419 | else => unreachable, |
| 3385 | const src_inst = loaded_struct.zir_index.resolveFull(ip) orelse { | 3420 | .struct_type => { |
| 3386 | try dwarf.lostTracking(di_nw); | 3421 | const loaded_struct = ip.loadStructType(@"const"); |
| 3387 | break :done; | 3422 | const src_inst = loaded_struct.zir_index.resolveFull(ip) orelse { |
| 3388 | }; | 3423 | try dwarf.lostTracking(di_nw); |
| 3389 | const zf = zcu.fileByIndex(src_inst.file); | 3424 | break :done; |
| 3390 | const zir = &zf.zir.?; | 3425 | }; |
| 3391 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); | 3426 | const zf = zcu.fileByIndex(src_inst.file); |
| 3392 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { | 3427 | const zir = &zf.zir.?; |
| 3393 | else => unreachable, | 3428 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); |
| 3394 | .struct_init, .struct_init_ref => { | 3429 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { |
| 3395 | const decl = zir.extraData( | | |
| 3396 | std.zig.Zir.Inst.StructInit, | | |
| 3397 | inst.data.pl_node.payload_index, | | |
| 3398 | ).data; | | |
| 3399 | break :decl .{ decl.src_line, decl.src_column, &.{} }; | | |
| 3400 | }, | | |
| 3401 | .struct_init_anon => { | | |
| 3402 | const decl = zir.extraData( | | |
| 3403 | std.zig.Zir.Inst.StructInitAnon, | | |
| 3404 | inst.data.pl_node.payload_index, | | |
| 3405 | ).data; | | |
| 3406 | break :decl .{ decl.src_line, decl.src_column, &.{} }; | | |
| 3407 | }, | | |
| 3408 | .extended => switch (inst.data.extended.opcode) { | | |
| 3409 | else => unreachable, | 3430 | else => unreachable, |
| 3410 | .struct_decl => { | 3431 | .struct_init, .struct_init_ref => { |
| 3411 | const decl = zir.getStructDecl(src_inst.inst); | | |
| 3412 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; | | |
| 3413 | }, | | |
| 3414 | .reify_struct => { | | |
| 3415 | const decl = zir.extraData( | 3432 | const decl = zir.extraData( |
| 3416 | std.zig.Zir.Inst.ReifyStruct, | 3433 | std.zig.Zir.Inst.StructInit, |
| 3417 | inst.data.extended.operand, | 3434 | inst.data.pl_node.payload_index, |
| 3418 | ).data; | 3435 | ).data; |
| 3419 | break :decl .{ decl.src_line, decl.src_column, &.{} }; | 3436 | break :decl .{ decl.src_line, decl.src_column, &.{} }; |
| 3420 | }, | 3437 | }, |
| 3421 | }, | 3438 | .struct_init_anon => { |
| 3422 | }; | | |
| 3423 | break :container .{ | | |
| 3424 | .@"struct", | | |
| 3425 | zf, | | |
| 3426 | src_line, | | |
| 3427 | src_column, | | |
| 3428 | capture_names, | | |
| 3429 | loaded_struct.captures, | | |
| 3430 | loaded_struct.name, | | |
| 3431 | loaded_struct.name_nav, | | |
| 3432 | loaded_struct.namespace, | | |
| 3433 | }; | | |
| 3434 | }, | | |
| 3435 | .union_type => { | | |
| 3436 | const loaded_union = ip.loadUnionType(instance_val); | | |
| 3437 | const src_inst = loaded_union.zir_index.resolveFull(ip) orelse { | | |
| 3438 | try dwarf.lostTracking(di_nw); | | |
| 3439 | break :done; | | |
| 3440 | }; | | |
| 3441 | const zf = zcu.fileByIndex(src_inst.file); | | |
| 3442 | const zir = &zf.zir.?; | | |
| 3443 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); | | |
| 3444 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { | | |
| 3445 | else => unreachable, | | |
| 3446 | .extended => switch (inst.data.extended.opcode) { | | |
| 3447 | else => unreachable, | | |
| 3448 | .union_decl => { | | |
| 3449 | const decl = zir.getUnionDecl(src_inst.inst); | | |
| 3450 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; | | |
| 3451 | }, | | |
| 3452 | .reify_union => { | | |
| 3453 | const decl = zir.extraData( | 3439 | const decl = zir.extraData( |
| 3454 | std.zig.Zir.Inst.ReifyUnion, | 3440 | std.zig.Zir.Inst.StructInitAnon, |
| 3455 | inst.data.extended.operand, | 3441 | inst.data.pl_node.payload_index, |
| 3456 | ).data; | 3442 | ).data; |
| 3457 | break :decl .{ decl.src_line, decl.src_column, &.{} }; | 3443 | break :decl .{ decl.src_line, decl.src_column, &.{} }; |
| 3458 | }, | 3444 | }, |
| 3459 | }, | 3445 | .extended => switch (inst.data.extended.opcode) { |
| 3460 | }; | 3446 | else => unreachable, |
| 3461 | break :container .{ | 3447 | .struct_decl => { |
| 3462 | .@"union", | 3448 | const decl = zir.getStructDecl(src_inst.inst); |
| 3463 | zf, | 3449 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; |
| 3464 | src_line, | 3450 | }, |
| 3465 | src_column, | 3451 | .reify_struct => { |
| 3466 | capture_names, | 3452 | const decl = zir.extraData( |
| 3467 | loaded_union.captures, | 3453 | std.zig.Zir.Inst.ReifyStruct, |
| 3468 | loaded_union.name, | 3454 | inst.data.extended.operand, |
| 3469 | loaded_union.name_nav, | 3455 | ).data; |
| 3470 | loaded_union.namespace, | 3456 | break :decl .{ decl.src_line, decl.src_column, &.{} }; |
| 3471 | }; | 3457 | }, |
| 3472 | }, | 3458 | }, |
| 3473 | .enum_type => { | 3459 | }; |
| 3474 | const loaded_enum = ip.loadEnumType(instance_val); | 3460 | break :container .{ |
| 3475 | const src_inst = loaded_enum.zir_index.unwrap().?.resolveFull(ip) orelse { | 3461 | .@"struct", |
| 3476 | try dwarf.lostTracking(di_nw); | 3462 | zf, |
| 3477 | break :done; | 3463 | src_line, |
| 3478 | }; | 3464 | src_column, |
| 3479 | const zf = zcu.fileByIndex(src_inst.file); | 3465 | capture_names, |
| 3480 | const zir = &zf.zir.?; | 3466 | loaded_struct.captures, |
| 3481 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); | 3467 | loaded_struct.name, |
| 3482 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { | 3468 | loaded_struct.name_nav, |
| 3483 | else => unreachable, | 3469 | loaded_struct.namespace, |
| 3484 | .extended => switch (inst.data.extended.opcode) { | 3470 | }; |
| | 3471 | }, |
| | 3472 | .union_type => { |
| | 3473 | const loaded_union = ip.loadUnionType(@"const"); |
| | 3474 | const src_inst = loaded_union.zir_index.resolveFull(ip) orelse { |
| | 3475 | try dwarf.lostTracking(di_nw); |
| | 3476 | break :done; |
| | 3477 | }; |
| | 3478 | const zf = zcu.fileByIndex(src_inst.file); |
| | 3479 | const zir = &zf.zir.?; |
| | 3480 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); |
| | 3481 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { |
| 3485 | else => unreachable, | 3482 | else => unreachable, |
| 3486 | .enum_decl => { | 3483 | .extended => switch (inst.data.extended.opcode) { |
| 3487 | const decl = zir.getEnumDecl(src_inst.inst); | 3484 | else => unreachable, |
| 3488 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; | 3485 | .union_decl => { |
| | 3486 | const decl = zir.getUnionDecl(src_inst.inst); |
| | 3487 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; |
| | 3488 | }, |
| | 3489 | .reify_union => { |
| | 3490 | const decl = zir.extraData( |
| | 3491 | std.zig.Zir.Inst.ReifyUnion, |
| | 3492 | inst.data.extended.operand, |
| | 3493 | ).data; |
| | 3494 | break :decl .{ decl.src_line, decl.src_column, &.{} }; |
| | 3495 | }, |
| 3489 | }, | 3496 | }, |
| 3490 | .reify_enum => { | 3497 | }; |
| 3491 | const decl = zir.extraData( | 3498 | break :container .{ |
| 3492 | std.zig.Zir.Inst.ReifyEnum, | 3499 | .@"union", |
| 3493 | inst.data.extended.operand, | 3500 | zf, |
| 3494 | ).data; | 3501 | src_line, |
| 3495 | break :decl .{ decl.src_line, decl.src_column, &.{} }; | 3502 | src_column, |
| | 3503 | capture_names, |
| | 3504 | loaded_union.captures, |
| | 3505 | loaded_union.name, |
| | 3506 | loaded_union.name_nav, |
| | 3507 | loaded_union.namespace, |
| | 3508 | }; |
| | 3509 | }, |
| | 3510 | .enum_type => { |
| | 3511 | const loaded_enum = ip.loadEnumType(@"const"); |
| | 3512 | const src_inst = loaded_enum.zir_index.unwrap().?.resolveFull(ip) orelse { |
| | 3513 | try dwarf.lostTracking(di_nw); |
| | 3514 | break :done; |
| | 3515 | }; |
| | 3516 | const zf = zcu.fileByIndex(src_inst.file); |
| | 3517 | const zir = &zf.zir.?; |
| | 3518 | const inst = zir.instructions.get(@backingInt(src_inst.inst)); |
| | 3519 | const src_line, const src_column, const capture_names = decl: switch (inst.tag) { |
| | 3520 | else => unreachable, |
| | 3521 | .extended => switch (inst.data.extended.opcode) { |
| | 3522 | else => unreachable, |
| | 3523 | .enum_decl => { |
| | 3524 | const decl = zir.getEnumDecl(src_inst.inst); |
| | 3525 | break :decl .{ decl.src_line, decl.src_column, decl.capture_names }; |
| | 3526 | }, |
| | 3527 | .reify_enum => { |
| | 3528 | const decl = zir.extraData( |
| | 3529 | std.zig.Zir.Inst.ReifyEnum, |
| | 3530 | inst.data.extended.operand, |
| | 3531 | ).data; |
| | 3532 | break :decl .{ decl.src_line, decl.src_column, &.{} }; |
| | 3533 | }, |
| 3496 | }, | 3534 | }, |
| | 3535 | }; |
| | 3536 | break :container .{ |
| | 3537 | .@"enum", |
| | 3538 | zf, |
| | 3539 | src_line, |
| | 3540 | src_column, |
| | 3541 | capture_names, |
| | 3542 | loaded_enum.captures, |
| | 3543 | loaded_enum.name, |
| | 3544 | loaded_enum.name_nav, |
| | 3545 | loaded_enum.namespace, |
| | 3546 | }; |
| | 3547 | }, |
| | 3548 | .opaque_type => { |
| | 3549 | const loaded_opaque = ip.loadOpaqueType(@"const"); |
| | 3550 | const src_inst = loaded_opaque.zir_index.resolveFull(ip) orelse { |
| | 3551 | try dwarf.lostTracking(di_nw); |
| | 3552 | break :done; |
| | 3553 | }; |
| | 3554 | const zf = zcu.fileByIndex(src_inst.file); |
| | 3555 | const decl = zf.zir.?.getOpaqueDecl(src_inst.inst); |
| | 3556 | break :container .{ |
| | 3557 | .@"struct", |
| | 3558 | zf, |
| | 3559 | decl.src_line, |
| | 3560 | decl.src_column, |
| | 3561 | decl.capture_names, |
| | 3562 | loaded_opaque.captures, |
| | 3563 | loaded_opaque.name, |
| | 3564 | loaded_opaque.name_nav, |
| | 3565 | loaded_opaque.namespace, |
| | 3566 | }; |
| | 3567 | }, |
| | 3568 | }; |
| | 3569 | const zir = &zf.zir.?; |
| | 3570 | if (maybe_name_nav.unwrap()) |name_ni| { |
| | 3571 | const name_nav = ip.getNav(name_ni); |
| | 3572 | const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); |
| | 3573 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| | 3574 | name_nav.analysis.?.namespace, |
| | 3575 | ).owner_type); |
| | 3576 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { |
| | 3577 | .@"struct" => .decl_specification_struct, |
| | 3578 | .@"union" => .decl_specification_union, |
| | 3579 | .@"enum" => .decl_specification_enum, |
| | 3580 | } else switch (kind) { |
| | 3581 | .@"struct" => .decl_specification_empty_struct, |
| | 3582 | .@"union" => .decl_specification_empty_union, |
| | 3583 | .@"enum" => .decl_specification_empty_enum, |
| | 3584 | }); |
| | 3585 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| | 3586 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| | 3587 | try di_w.writeUleb128(decl.src_column + 1); |
| | 3588 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| | 3589 | try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip)); |
| | 3590 | } else { |
| | 3591 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| | 3592 | ip.namespacePtr(namespace).parent.unwrap().?, |
| | 3593 | ).owner_type); |
| | 3594 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { |
| | 3595 | .@"struct" => .type_decl_specification_struct, |
| | 3596 | .@"union" => .type_decl_specification_union, |
| | 3597 | .@"enum" => .type_decl_specification_enum, |
| | 3598 | } else switch (kind) { |
| | 3599 | .@"struct" => .type_decl_specification_empty_struct, |
| | 3600 | .@"union" => .type_decl_specification_empty_union, |
| | 3601 | .@"enum" => .type_decl_specification_empty_enum, |
| | 3602 | }); |
| | 3603 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| | 3604 | try di_w.writeInt(u32, src_line + 1, dwarf.endian); |
| | 3605 | try di_w.writeUleb128(src_column + 1); |
| | 3606 | try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip)); |
| | 3607 | } |
| | 3608 | for (capture_names, captures.get(ip)) |capture_name, capture| { |
| | 3609 | try dwarf.abbrevCode(di_nw, .capture_specification); |
| | 3610 | switch (capture.unwrap()) { |
| | 3611 | .@"comptime", .runtime, .nav_val => try dwarf.strp( |
| | 3612 | &dwarf.debug_str, |
| | 3613 | di_nw, |
| | 3614 | zir.nullTerminatedString(capture_name), |
| | 3615 | ), |
| | 3616 | .nav_ref => { |
| | 3617 | const capture_name_slice = |
| | 3618 | try zcu.gpa.print("&{s}", .{zir.nullTerminatedString(capture_name)}); |
| | 3619 | defer zcu.gpa.free(capture_name_slice); |
| | 3620 | try dwarf.strp(&dwarf.debug_str, di_nw, capture_name_slice); |
| 3497 | }, | 3621 | }, |
| 3498 | }; | 3622 | } |
| 3499 | break :container .{ | 3623 | } |
| 3500 | .@"enum", | 3624 | if (captures.len > 0) try di_w.writeUleb128(@backingInt(AbbrevCode.null)); |
| 3501 | zf, | 3625 | }, |
| 3502 | src_line, | 3626 | .global => |global| { |
| 3503 | src_column, | 3627 | const nav = ip.getNav(global); |
| 3504 | capture_names, | 3628 | const src_inst = nav.srcInst(ip).resolveFull(ip).?; |
| 3505 | loaded_enum.captures, | 3629 | const decl = zcu.fileByIndex(src_inst.file).zir.?.getDeclaration(src_inst.inst); |
| 3506 | loaded_enum.name, | 3630 | const parent_ni = try dwarf.getConstDecl(pt, ip.namespacePtr( |
| 3507 | loaded_enum.name_nav, | 3631 | nav.analysis.?.namespace, |
| 3508 | loaded_enum.namespace, | 3632 | ).owner_type); |
| 3509 | }; | 3633 | try dwarf.abbrevCode(di_nw, if (nav.resolved.?.@"const") switch (nav.resolved.?.type) { |
| 3510 | }, | 3634 | .type_type => .decl_specification_type, |
| 3511 | .opaque_type => { | 3635 | else => .decl_specification_const, |
| 3512 | const loaded_opaque = ip.loadOpaqueType(instance_val); | 3636 | } else .decl_specification_var); |
| 3513 | const src_inst = loaded_opaque.zir_index.resolveFull(ip) orelse { | | |
| 3514 | try dwarf.lostTracking(di_nw); | | |
| 3515 | break :done; | | |
| 3516 | }; | | |
| 3517 | const zf = zcu.fileByIndex(src_inst.file); | | |
| 3518 | const decl = zf.zir.?.getOpaqueDecl(src_inst.inst); | | |
| 3519 | break :container .{ | | |
| 3520 | .@"struct", | | |
| 3521 | zf, | | |
| 3522 | decl.src_line, | | |
| 3523 | decl.src_column, | | |
| 3524 | decl.capture_names, | | |
| 3525 | loaded_opaque.captures, | | |
| 3526 | loaded_opaque.name, | | |
| 3527 | loaded_opaque.name_nav, | | |
| 3528 | loaded_opaque.namespace, | | |
| 3529 | }; | | |
| 3530 | }, | | |
| 3531 | }; | | |
| 3532 | const zir = &zf.zir.?; | | |
| 3533 | if (maybe_name_nav.unwrap()) |name_ni| { | | |
| 3534 | const name_nav = ip.getNav(name_ni); | | |
| 3535 | const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?); | | |
| 3536 | const parent_ni = | | |
| 3537 | try dwarf.getDecl(pt, ip.namespacePtr(name_nav.analysis.?.namespace).owner_type); | | |
| 3538 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { | | |
| 3539 | .@"struct" => .decl_specification_struct, | | |
| 3540 | .@"union" => .decl_specification_union, | | |
| 3541 | .@"enum" => .decl_specification_enum, | | |
| 3542 | } else switch (kind) { | | |
| 3543 | .@"struct" => .decl_specification_empty_struct, | | |
| 3544 | .@"union" => .decl_specification_empty_union, | | |
| 3545 | .@"enum" => .decl_specification_empty_enum, | | |
| 3546 | }); | | |
| 3547 | try dwarf.secOffset(di_nw, parent_ni, 0); | 3637 | try dwarf.secOffset(di_nw, parent_ni, 0); |
| 3548 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); | 3638 | try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian); |
| 3549 | try di_w.writeUleb128(decl.src_column + 1); | 3639 | try di_w.writeUleb128(decl.src_column + 1); |
| 3550 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); | 3640 | try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private); |
| 3551 | try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip)); | 3641 | try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip)); |
| 3552 | } else { | 3642 | }, |
| 3553 | const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr( | | |
| 3554 | ip.namespacePtr(namespace).parent.unwrap().?, | | |
| 3555 | ).owner_type); | | |
| 3556 | try dwarf.abbrevCode(di_nw, if (captures.len > 0) switch (kind) { | | |
| 3557 | .@"struct" => .type_decl_specification_struct, | | |
| 3558 | .@"union" => .type_decl_specification_union, | | |
| 3559 | .@"enum" => .type_decl_specification_enum, | | |
| 3560 | } else switch (kind) { | | |
| 3561 | .@"struct" => .type_decl_specification_empty_struct, | | |
| 3562 | .@"union" => .type_decl_specification_empty_union, | | |
| 3563 | .@"enum" => .type_decl_specification_empty_enum, | | |
| 3564 | }); | | |
| 3565 | try dwarf.secOffset(di_nw, parent_ni, 0); | | |
| 3566 | try di_w.writeInt(u32, src_line + 1, dwarf.endian); | | |
| 3567 | try di_w.writeUleb128(src_column + 1); | | |
| 3568 | try dwarf.strp(&dwarf.debug_str, di_nw, name.toSlice(ip)); | | |
| 3569 | } | | |
| 3570 | for (capture_names, captures.get(ip)) |capture_name, capture| { | | |
| 3571 | try dwarf.abbrevCode(di_nw, .capture_specification); | | |
| 3572 | switch (capture.unwrap()) { | | |
| 3573 | .@"comptime", .runtime, .nav_val => try dwarf.strp( | | |
| 3574 | &dwarf.debug_str, | | |
| 3575 | di_nw, | | |
| 3576 | zir.nullTerminatedString(capture_name), | | |
| 3577 | ), | | |
| 3578 | .nav_ref => { | | |
| 3579 | const capture_name_slice = | | |
| 3580 | try zcu.gpa.print("&{s}", .{zir.nullTerminatedString(capture_name)}); | | |
| 3581 | defer zcu.gpa.free(capture_name_slice); | | |
| 3582 | try dwarf.strp(&dwarf.debug_str, di_nw, capture_name_slice); | | |
| 3583 | }, | | |
| 3584 | } | | |
| 3585 | } | | |
| 3586 | if (captures.len > 0) try di_w.writeUleb128(@backingInt(AbbrevCode.null)); | | |
| 3587 | } | 3643 | } |
| 3588 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); | 3644 | try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen()); |
| 3589 | } | 3645 | } |
| ... | @@ -3887,7 +3943,6 @@ pub const AbbrevCode = enum { | ... | @@ -3887,7 +3943,6 @@ pub const AbbrevCode = enum { |
| 3887 | pad_n, | 3943 | pad_n, |
| 3888 | // decl, specification, and instance codes are assumed to all have the same uleb128 size | 3944 | // decl, specification, and instance codes are assumed to all have the same uleb128 size |
| 3889 | decl_lost, | 3945 | decl_lost, |
| 3890 | decl_type, | | |
| 3891 | decl_empty_incomplete_enum, | 3946 | decl_empty_incomplete_enum, |
| 3892 | decl_incomplete_enum, | 3947 | decl_incomplete_enum, |
| 3893 | decl_empty_enum, | 3948 | decl_empty_enum, |
| ... | @@ -3920,11 +3975,12 @@ pub const AbbrevCode = enum { | ... | @@ -3920,11 +3975,12 @@ pub const AbbrevCode = enum { |
| 3920 | decl_packed_union, | 3975 | decl_packed_union, |
| 3921 | type_decl_empty_packed_union, | 3976 | type_decl_empty_packed_union, |
| 3922 | type_decl_packed_union, | 3977 | type_decl_packed_union, |
| 3923 | decl_var, | 3978 | decl_type, |
| 3924 | decl_const, | 3979 | decl_const, |
| 3925 | decl_const_fully_runtime, | 3980 | decl_const_fully_runtime, |
| 3926 | decl_const_partially_comptime, | 3981 | decl_const_partially_comptime, |
| 3927 | decl_const_fully_comptime, | 3982 | decl_const_fully_comptime, |
| | 3983 | decl_var, |
| 3928 | decl_empty_func, | 3984 | decl_empty_func, |
| 3929 | decl_func, | 3985 | decl_func, |
| 3930 | decl_empty_func_generic, | 3986 | decl_empty_func_generic, |
| ... | @@ -3943,6 +3999,9 @@ pub const AbbrevCode = enum { | ... | @@ -3943,6 +3999,9 @@ pub const AbbrevCode = enum { |
| 3943 | decl_specification_union, | 3999 | decl_specification_union, |
| 3944 | type_decl_specification_empty_union, | 4000 | type_decl_specification_empty_union, |
| 3945 | type_decl_specification_union, | 4001 | type_decl_specification_union, |
| | 4002 | decl_specification_type, |
| | 4003 | decl_specification_const, |
| | 4004 | decl_specification_var, |
| 3946 | decl_specification_func, | 4005 | decl_specification_func, |
| 3947 | decl_instance_type, | 4006 | decl_instance_type, |
| 3948 | decl_instance_empty_incomplete_enum, | 4007 | decl_instance_empty_incomplete_enum, |
| ... | @@ -4063,7 +4122,7 @@ pub const AbbrevCode = enum { | ... | @@ -4063,7 +4122,7 @@ pub const AbbrevCode = enum { |
| 4063 | comptime { | 4122 | comptime { |
| 4064 | assert(uleb128Size(@backingInt(AbbrevCode.pad_1)) == 1); | 4123 | assert(uleb128Size(@backingInt(AbbrevCode.pad_1)) == 1); |
| 4065 | assert(uleb128Size(@backingInt(AbbrevCode.pad_n)) == 1); | 4124 | assert(uleb128Size(@backingInt(AbbrevCode.pad_n)) == 1); |
| 4066 | assert(uleb128Size(@backingInt(AbbrevCode.decl_type)) == decl_size); | 4125 | assert(uleb128Size(@backingInt(AbbrevCode.decl_lost)) == decl_size); |
| 4067 | } | 4126 | } |
| 4068 | | 4127 | |
| 4069 | const Attr = struct { | 4128 | const Attr = struct { |
| ... | @@ -4111,12 +4170,6 @@ pub const AbbrevCode = enum { | ... | @@ -4111,12 +4170,6 @@ pub const AbbrevCode = enum { |
| 4111 | .decl_lost = .{ | 4170 | .decl_lost = .{ |
| 4112 | .tag = .ZIG_lost_declaration, | 4171 | .tag = .ZIG_lost_declaration, |
| 4113 | }, | 4172 | }, |
| 4114 | .decl_type = .{ | | |
| 4115 | .tag = .imported_declaration, | | |
| 4116 | .attrs = decl_attrs ++ .{ | | |
| 4117 | .{ .import, .ref_addr }, | | |
| 4118 | }, | | |
| 4119 | }, | | |
| 4120 | .decl_empty_incomplete_enum = .{ | 4173 | .decl_empty_incomplete_enum = .{ |
| 4121 | .tag = .enumeration_type, | 4174 | .tag = .enumeration_type, |
| 4122 | .attrs = decl_attrs, | 4175 | .attrs = decl_attrs, |
| ... | @@ -4309,6 +4362,12 @@ pub const AbbrevCode = enum { | ... | @@ -4309,6 +4362,12 @@ pub const AbbrevCode = enum { |
| 4309 | .{ .type, .ref_addr }, | 4362 | .{ .type, .ref_addr }, |
| 4310 | }, | 4363 | }, |
| 4311 | }, | 4364 | }, |
| | 4365 | .decl_type = .{ |
| | 4366 | .tag = .imported_declaration, |
| | 4367 | .attrs = decl_attrs ++ .{ |
| | 4368 | .{ .import, .ref_addr }, |
| | 4369 | }, |
| | 4370 | }, |
| 4312 | .decl_var = .{ | 4371 | .decl_var = .{ |
| 4313 | .tag = .variable, | 4372 | .tag = .variable, |
| 4314 | .attrs = decl_attrs ++ .{ | 4373 | .attrs = decl_attrs ++ .{ |
| ... | @@ -4472,13 +4531,27 @@ pub const AbbrevCode = enum { | ... | @@ -4472,13 +4531,27 @@ pub const AbbrevCode = enum { |
| 4472 | .children = true, | 4531 | .children = true, |
| 4473 | .attrs = type_decl_specification_attrs, | 4532 | .attrs = type_decl_specification_attrs, |
| 4474 | }, | 4533 | }, |
| | 4534 | .decl_specification_type = .{ |
| | 4535 | .tag = .imported_declaration, |
| | 4536 | .attrs = decl_specification_attrs, |
| | 4537 | }, |
| | 4538 | .decl_specification_const = .{ |
| | 4539 | .tag = .constant, |
| | 4540 | .attrs = decl_specification_attrs, |
| | 4541 | }, |
| | 4542 | .decl_specification_var = .{ |
| | 4543 | .tag = .variable, |
| | 4544 | .attrs = decl_specification_attrs, |
| | 4545 | }, |
| 4475 | .decl_specification_func = .{ | 4546 | .decl_specification_func = .{ |
| 4476 | .tag = .subprogram, | 4547 | .tag = .subprogram, |
| 4477 | .attrs = decl_specification_attrs, | 4548 | .attrs = decl_specification_attrs, |
| 4478 | }, | 4549 | }, |
| 4479 | .decl_instance_type = .{ | 4550 | .decl_instance_type = .{ |
| 4480 | .tag = .imported_declaration, | 4551 | .tag = .imported_declaration, |
| 4481 | .attrs = decl_instance_attrs ++ .{ | 4552 | .attrs = .{ |
| | 4553 | .{ .ZIG_parent, .ref_addr }, |
| | 4554 | } ++ decl_instance_attrs ++ .{ |
| 4482 | .{ .import, .ref_addr }, | 4555 | .{ .import, .ref_addr }, |
| 4483 | }, | 4556 | }, |
| 4484 | }, | 4557 | }, |