| ... | @@ -814,14 +814,17 @@ pub const Object = struct { | ... | @@ -814,14 +814,17 @@ pub const Object = struct { |
| 814 | | 814 | |
| 815 | debug_enums_fwd_ref: Builder.Metadata, | 815 | debug_enums_fwd_ref: Builder.Metadata, |
| 816 | debug_globals_fwd_ref: Builder.Metadata, | 816 | debug_globals_fwd_ref: Builder.Metadata, |
| | 817 | debug_imports_fwd_ref: Builder.Metadata, |
| 817 | | 818 | |
| 818 | debug_enums: std.ArrayListUnmanaged(Builder.Metadata), | 819 | debug_enums: std.ArrayListUnmanaged(Builder.Metadata), |
| 819 | debug_globals: std.ArrayListUnmanaged(Builder.Metadata), | 820 | debug_globals: std.ArrayListUnmanaged(Builder.Metadata), |
| | 821 | debug_imports: std.ArrayListUnmanaged(Builder.Metadata), |
| 820 | | 822 | |
| 821 | debug_file_map: std.AutoHashMapUnmanaged(*const Zcu.File, Builder.Metadata), | 823 | debug_file_map: std.AutoHashMapUnmanaged(*const Zcu.File, Builder.Metadata), |
| 822 | debug_type_map: std.AutoHashMapUnmanaged(Type, Builder.Metadata), | 824 | debug_type_map: std.AutoHashMapUnmanaged(Type, Builder.Metadata), |
| 823 | | 825 | |
| 824 | debug_unresolved_namespace_scopes: std.AutoArrayHashMapUnmanaged(InternPool.NamespaceIndex, Builder.Metadata), | 826 | // The value says whether this namespace's type is runtime-required. |
| | 827 | debug_unresolved_namespace_scopes: std.AutoArrayHashMapUnmanaged(Type, bool), |
| 825 | | 828 | |
| 826 | target: std.Target, | 829 | target: std.Target, |
| 827 | /// Ideally we would use `llvm_module.getNamedFunction` to go from *Decl to LLVM function, | 830 | /// Ideally we would use `llvm_module.getNamedFunction` to go from *Decl to LLVM function, |
| ... | @@ -884,7 +887,7 @@ pub const Object = struct { | ... | @@ -884,7 +887,7 @@ pub const Object = struct { |
| 884 | | 887 | |
| 885 | builder.data_layout = try builder.fmt("{}", .{DataLayoutBuilder{ .target = target }}); | 888 | builder.data_layout = try builder.fmt("{}", .{DataLayoutBuilder{ .target = target }}); |
| 886 | | 889 | |
| 887 | const debug_compile_unit, const debug_enums_fwd_ref, const debug_globals_fwd_ref = | 890 | const debug_compile_unit, const debug_enums_fwd_ref, const debug_globals_fwd_ref, const debug_imports_fwd_ref = |
| 888 | if (!builder.strip) | 891 | if (!builder.strip) |
| 889 | debug_info: { | 892 | debug_info: { |
| 890 | // We fully resolve all paths at this point to avoid lack of | 893 | // We fully resolve all paths at this point to avoid lack of |
| ... | @@ -916,6 +919,7 @@ pub const Object = struct { | ... | @@ -916,6 +919,7 @@ pub const Object = struct { |
| 916 | | 919 | |
| 917 | const debug_enums_fwd_ref = try builder.debugForwardReference(); | 920 | const debug_enums_fwd_ref = try builder.debugForwardReference(); |
| 918 | const debug_globals_fwd_ref = try builder.debugForwardReference(); | 921 | const debug_globals_fwd_ref = try builder.debugForwardReference(); |
| | 922 | const debug_imports_fwd_ref = try builder.debugForwardReference(); |
| 919 | | 923 | |
| 920 | const debug_compile_unit = try builder.debugCompileUnit( | 924 | const debug_compile_unit = try builder.debugCompileUnit( |
| 921 | debug_file, | 925 | debug_file, |
| ... | @@ -928,6 +932,7 @@ pub const Object = struct { | ... | @@ -928,6 +932,7 @@ pub const Object = struct { |
| 928 | }), | 932 | }), |
| 929 | debug_enums_fwd_ref, | 933 | debug_enums_fwd_ref, |
| 930 | debug_globals_fwd_ref, | 934 | debug_globals_fwd_ref, |
| | 935 | debug_imports_fwd_ref, |
| 931 | .{ .optimized = comp.root_mod.optimize_mode != .Debug }, | 936 | .{ .optimized = comp.root_mod.optimize_mode != .Debug }, |
| 932 | ); | 937 | ); |
| 933 | | 938 | |
| ... | @@ -983,8 +988,8 @@ pub const Object = struct { | ... | @@ -983,8 +988,8 @@ pub const Object = struct { |
| 983 | } | 988 | } |
| 984 | | 989 | |
| 985 | try builder.debugNamed(try builder.metadataString("llvm.dbg.cu"), &.{debug_compile_unit}); | 990 | try builder.debugNamed(try builder.metadataString("llvm.dbg.cu"), &.{debug_compile_unit}); |
| 986 | break :debug_info .{ debug_compile_unit, debug_enums_fwd_ref, debug_globals_fwd_ref }; | 991 | break :debug_info .{ debug_compile_unit, debug_enums_fwd_ref, debug_globals_fwd_ref, debug_imports_fwd_ref }; |
| 987 | } else .{.none} ** 3; | 992 | } else .{.none} ** 4; |
| 988 | | 993 | |
| 989 | const obj = try arena.create(Object); | 994 | const obj = try arena.create(Object); |
| 990 | obj.* = .{ | 995 | obj.* = .{ |
| ... | @@ -997,8 +1002,10 @@ pub const Object = struct { | ... | @@ -997,8 +1002,10 @@ pub const Object = struct { |
| 997 | .debug_compile_unit = debug_compile_unit, | 1002 | .debug_compile_unit = debug_compile_unit, |
| 998 | .debug_enums_fwd_ref = debug_enums_fwd_ref, | 1003 | .debug_enums_fwd_ref = debug_enums_fwd_ref, |
| 999 | .debug_globals_fwd_ref = debug_globals_fwd_ref, | 1004 | .debug_globals_fwd_ref = debug_globals_fwd_ref, |
| | 1005 | .debug_imports_fwd_ref = debug_imports_fwd_ref, |
| 1000 | .debug_enums = .{}, | 1006 | .debug_enums = .{}, |
| 1001 | .debug_globals = .{}, | 1007 | .debug_globals = .{}, |
| | 1008 | .debug_imports = .{}, |
| 1002 | .debug_file_map = .{}, | 1009 | .debug_file_map = .{}, |
| 1003 | .debug_type_map = .{}, | 1010 | .debug_type_map = .{}, |
| 1004 | .debug_unresolved_namespace_scopes = .{}, | 1011 | .debug_unresolved_namespace_scopes = .{}, |
| ... | @@ -1151,6 +1158,11 @@ pub const Object = struct { | ... | @@ -1151,6 +1158,11 @@ pub const Object = struct { |
| 1151 | self.debug_globals_fwd_ref, | 1158 | self.debug_globals_fwd_ref, |
| 1152 | try self.builder.debugTuple(self.debug_globals.items), | 1159 | try self.builder.debugTuple(self.debug_globals.items), |
| 1153 | ); | 1160 | ); |
| | 1161 | |
| | 1162 | self.builder.debugForwardReferenceSetType( |
| | 1163 | self.debug_imports_fwd_ref, |
| | 1164 | try self.builder.debugTuple(self.debug_imports.items), |
| | 1165 | ); |
| 1154 | } | 1166 | } |
| 1155 | } | 1167 | } |
| 1156 | | 1168 | |
| ... | @@ -1634,7 +1646,7 @@ pub const Object = struct { | ... | @@ -1634,7 +1646,7 @@ pub const Object = struct { |
| 1634 | | 1646 | |
| 1635 | const line_number = decl.navSrcLine(zcu) + 1; | 1647 | const line_number = decl.navSrcLine(zcu) + 1; |
| 1636 | const is_internal_linkage = decl.val.getExternFunc(zcu) == null; | 1648 | const is_internal_linkage = decl.val.getExternFunc(zcu) == null; |
| 1637 | const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu)); | 1649 | const debug_decl_type = try o.lowerDebugType(decl.typeOf(zcu), true); |
| 1638 | | 1650 | |
| 1639 | const subprogram = try o.builder.debugSubprogram( | 1651 | const subprogram = try o.builder.debugSubprogram( |
| 1640 | file, | 1652 | file, |
| ... | @@ -1904,6 +1916,7 @@ pub const Object = struct { | ... | @@ -1904,6 +1916,7 @@ pub const Object = struct { |
| 1904 | pub fn lowerDebugType( | 1916 | pub fn lowerDebugType( |
| 1905 | o: *Object, | 1917 | o: *Object, |
| 1906 | ty: Type, | 1918 | ty: Type, |
| | 1919 | required_by_runtime: bool, |
| 1907 | ) Allocator.Error!Builder.Metadata { | 1920 | ) Allocator.Error!Builder.Metadata { |
| 1908 | assert(!o.builder.strip); | 1921 | assert(!o.builder.strip); |
| 1909 | | 1922 | |
| ... | @@ -1913,8 +1926,13 @@ pub const Object = struct { | ... | @@ -1913,8 +1926,13 @@ pub const Object = struct { |
| 1913 | const zcu = pt.zcu; | 1926 | const zcu = pt.zcu; |
| 1914 | const ip = &zcu.intern_pool; | 1927 | const ip = &zcu.intern_pool; |
| 1915 | | 1928 | |
| 1916 | if (o.debug_type_map.get(ty)) |debug_type| return debug_type; | 1929 | if (o.debug_type_map.get(ty)) |debug_type| { |
| 1917 | | 1930 | if (required_by_runtime) { |
| | 1931 | if (o.debug_unresolved_namespace_scopes.getEntry(ty)) |entry| |
| | 1932 | entry.value_ptr.* = true; |
| | 1933 | } |
| | 1934 | return debug_type; |
| | 1935 | } |
| 1918 | | 1936 | |
| 1919 | switch (ty.zigTypeTag(zcu)) { | 1937 | switch (ty.zigTypeTag(zcu)) { |
| 1920 | .Void, | 1938 | .Void, |
| ... | @@ -1988,7 +2006,7 @@ pub const Object = struct { | ... | @@ -1988,7 +2006,7 @@ pub const Object = struct { |
| 1988 | }, | 2006 | }, |
| 1989 | }, | 2007 | }, |
| 1990 | }); | 2008 | }); |
| 1991 | const debug_ptr_type = try o.lowerDebugType(bland_ptr_ty); | 2009 | const debug_ptr_type = try o.lowerDebugType(bland_ptr_ty, required_by_runtime); |
| 1992 | try o.debug_type_map.put(gpa, ty, debug_ptr_type); | 2010 | try o.debug_type_map.put(gpa, ty, debug_ptr_type); |
| 1993 | return debug_ptr_type; | 2011 | return debug_ptr_type; |
| 1994 | } | 2012 | } |
| ... | @@ -2019,7 +2037,7 @@ pub const Object = struct { | ... | @@ -2019,7 +2037,7 @@ pub const Object = struct { |
| 2019 | .none, // File | 2037 | .none, // File |
| 2020 | debug_fwd_ref, | 2038 | debug_fwd_ref, |
| 2021 | 0, // Line | 2039 | 0, // Line |
| 2022 | try o.lowerDebugType(ptr_ty), | 2040 | try o.lowerDebugType(ptr_ty, required_by_runtime), |
| 2023 | ptr_size * 8, | 2041 | ptr_size * 8, |
| 2024 | (ptr_align.toByteUnits() orelse 0) * 8, | 2042 | (ptr_align.toByteUnits() orelse 0) * 8, |
| 2025 | 0, // Offset | 2043 | 0, // Offset |
| ... | @@ -2030,7 +2048,7 @@ pub const Object = struct { | ... | @@ -2030,7 +2048,7 @@ pub const Object = struct { |
| 2030 | .none, // File | 2048 | .none, // File |
| 2031 | debug_fwd_ref, | 2049 | debug_fwd_ref, |
| 2032 | 0, // Line | 2050 | 0, // Line |
| 2033 | try o.lowerDebugType(len_ty), | 2051 | try o.lowerDebugType(len_ty, required_by_runtime), |
| 2034 | len_size * 8, | 2052 | len_size * 8, |
| 2035 | (len_align.toByteUnits() orelse 0) * 8, | 2053 | (len_align.toByteUnits() orelse 0) * 8, |
| 2036 | len_offset * 8, | 2054 | len_offset * 8, |
| ... | @@ -2059,7 +2077,7 @@ pub const Object = struct { | ... | @@ -2059,7 +2077,7 @@ pub const Object = struct { |
| 2059 | return debug_slice_type; | 2077 | return debug_slice_type; |
| 2060 | } | 2078 | } |
| 2061 | | 2079 | |
| 2062 | const debug_elem_ty = try o.lowerDebugType(Type.fromInterned(ptr_info.child)); | 2080 | const debug_elem_ty = try o.lowerDebugType(Type.fromInterned(ptr_info.child), required_by_runtime); |
| 2063 | | 2081 | |
| 2064 | const name = try o.allocTypeName(ty); | 2082 | const name = try o.allocTypeName(ty); |
| 2065 | defer gpa.free(name); | 2083 | defer gpa.free(name); |
| ... | @@ -2089,7 +2107,7 @@ pub const Object = struct { | ... | @@ -2089,7 +2107,7 @@ pub const Object = struct { |
| 2089 | .none, // File | 2107 | .none, // File |
| 2090 | .none, // Scope | 2108 | .none, // Scope |
| 2091 | 0, // Line | 2109 | 0, // Line |
| 2092 | try o.lowerDebugType(ty.childType(zcu)), | 2110 | try o.lowerDebugType(ty.childType(zcu), required_by_runtime), |
| 2093 | ty.abiSize(pt) * 8, | 2111 | ty.abiSize(pt) * 8, |
| 2094 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | 2112 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| 2095 | try o.builder.debugTuple(&.{ | 2113 | try o.builder.debugTuple(&.{ |
| ... | @@ -2124,7 +2142,7 @@ pub const Object = struct { | ... | @@ -2124,7 +2142,7 @@ pub const Object = struct { |
| 2124 | try o.builder.metadataString("bool"), | 2142 | try o.builder.metadataString("bool"), |
| 2125 | 1, | 2143 | 1, |
| 2126 | ), | 2144 | ), |
| 2127 | else => try o.lowerDebugType(ty.childType(zcu)), | 2145 | else => try o.lowerDebugType(ty.childType(zcu), required_by_runtime), |
| 2128 | }; | 2146 | }; |
| 2129 | | 2147 | |
| 2130 | const debug_vector_type = try o.builder.debugVectorType( | 2148 | const debug_vector_type = try o.builder.debugVectorType( |
| ... | @@ -2166,7 +2184,7 @@ pub const Object = struct { | ... | @@ -2166,7 +2184,7 @@ pub const Object = struct { |
| 2166 | try o.debug_type_map.put(gpa, ty, debug_fwd_ref); | 2184 | try o.debug_type_map.put(gpa, ty, debug_fwd_ref); |
| 2167 | | 2185 | |
| 2168 | if (ty.optionalReprIsPayload(zcu)) { | 2186 | if (ty.optionalReprIsPayload(zcu)) { |
| 2169 | const debug_optional_type = try o.lowerDebugType(child_ty); | 2187 | const debug_optional_type = try o.lowerDebugType(child_ty, required_by_runtime); |
| 2170 | | 2188 | |
| 2171 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_optional_type); | 2189 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_optional_type); |
| 2172 | | 2190 | |
| ... | @@ -2189,7 +2207,7 @@ pub const Object = struct { | ... | @@ -2189,7 +2207,7 @@ pub const Object = struct { |
| 2189 | .none, // File | 2207 | .none, // File |
| 2190 | debug_fwd_ref, | 2208 | debug_fwd_ref, |
| 2191 | 0, // Line | 2209 | 0, // Line |
| 2192 | try o.lowerDebugType(child_ty), | 2210 | try o.lowerDebugType(child_ty, required_by_runtime), |
| 2193 | payload_size * 8, | 2211 | payload_size * 8, |
| 2194 | (payload_align.toByteUnits() orelse 0) * 8, | 2212 | (payload_align.toByteUnits() orelse 0) * 8, |
| 2195 | 0, // Offset | 2213 | 0, // Offset |
| ... | @@ -2200,7 +2218,7 @@ pub const Object = struct { | ... | @@ -2200,7 +2218,7 @@ pub const Object = struct { |
| 2200 | .none, | 2218 | .none, |
| 2201 | debug_fwd_ref, | 2219 | debug_fwd_ref, |
| 2202 | 0, | 2220 | 0, |
| 2203 | try o.lowerDebugType(non_null_ty), | 2221 | try o.lowerDebugType(non_null_ty, required_by_runtime), |
| 2204 | non_null_size * 8, | 2222 | non_null_size * 8, |
| 2205 | (non_null_align.toByteUnits() orelse 0) * 8, | 2223 | (non_null_align.toByteUnits() orelse 0) * 8, |
| 2206 | non_null_offset * 8, | 2224 | non_null_offset * 8, |
| ... | @@ -2232,7 +2250,7 @@ pub const Object = struct { | ... | @@ -2232,7 +2250,7 @@ pub const Object = struct { |
| 2232 | const payload_ty = ty.errorUnionPayload(zcu); | 2250 | const payload_ty = ty.errorUnionPayload(zcu); |
| 2233 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(pt)) { | 2251 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(pt)) { |
| 2234 | // TODO: Maybe remove? | 2252 | // TODO: Maybe remove? |
| 2235 | const debug_error_union_type = try o.lowerDebugType(Type.anyerror); | 2253 | const debug_error_union_type = try o.lowerDebugType(Type.anyerror, required_by_runtime); |
| 2236 | try o.debug_type_map.put(gpa, ty, debug_error_union_type); | 2254 | try o.debug_type_map.put(gpa, ty, debug_error_union_type); |
| 2237 | return debug_error_union_type; | 2255 | return debug_error_union_type; |
| 2238 | } | 2256 | } |
| ... | @@ -2269,7 +2287,7 @@ pub const Object = struct { | ... | @@ -2269,7 +2287,7 @@ pub const Object = struct { |
| 2269 | .none, // File | 2287 | .none, // File |
| 2270 | debug_fwd_ref, | 2288 | debug_fwd_ref, |
| 2271 | 0, // Line | 2289 | 0, // Line |
| 2272 | try o.lowerDebugType(Type.anyerror), | 2290 | try o.lowerDebugType(Type.anyerror, required_by_runtime), |
| 2273 | error_size * 8, | 2291 | error_size * 8, |
| 2274 | (error_align.toByteUnits() orelse 0) * 8, | 2292 | (error_align.toByteUnits() orelse 0) * 8, |
| 2275 | error_offset * 8, | 2293 | error_offset * 8, |
| ... | @@ -2279,7 +2297,7 @@ pub const Object = struct { | ... | @@ -2279,7 +2297,7 @@ pub const Object = struct { |
| 2279 | .none, // File | 2297 | .none, // File |
| 2280 | debug_fwd_ref, | 2298 | debug_fwd_ref, |
| 2281 | 0, // Line | 2299 | 0, // Line |
| 2282 | try o.lowerDebugType(payload_ty), | 2300 | try o.lowerDebugType(payload_ty, required_by_runtime), |
| 2283 | payload_size * 8, | 2301 | payload_size * 8, |
| 2284 | (payload_align.toByteUnits() orelse 0) * 8, | 2302 | (payload_align.toByteUnits() orelse 0) * 8, |
| 2285 | payload_offset * 8, | 2303 | payload_offset * 8, |
| ... | @@ -2321,21 +2339,21 @@ pub const Object = struct { | ... | @@ -2321,21 +2339,21 @@ pub const Object = struct { |
| 2321 | if (Type.fromInterned(fn_info.return_type).hasRuntimeBitsIgnoreComptime(pt)) { | 2339 | if (Type.fromInterned(fn_info.return_type).hasRuntimeBitsIgnoreComptime(pt)) { |
| 2322 | const sret = firstParamSRet(fn_info, pt, target); | 2340 | const sret = firstParamSRet(fn_info, pt, target); |
| 2323 | const ret_ty = if (sret) Type.void else Type.fromInterned(fn_info.return_type); | 2341 | const ret_ty = if (sret) Type.void else Type.fromInterned(fn_info.return_type); |
| 2324 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ret_ty)); | 2342 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ret_ty, required_by_runtime)); |
| 2325 | | 2343 | |
| 2326 | if (sret) { | 2344 | if (sret) { |
| 2327 | const ptr_ty = try pt.singleMutPtrType(Type.fromInterned(fn_info.return_type)); | 2345 | const ptr_ty = try pt.singleMutPtrType(Type.fromInterned(fn_info.return_type)); |
| 2328 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty)); | 2346 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty, required_by_runtime)); |
| 2329 | } | 2347 | } |
| 2330 | } else { | 2348 | } else { |
| 2331 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(Type.void)); | 2349 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(Type.void, required_by_runtime)); |
| 2332 | } | 2350 | } |
| 2333 | | 2351 | |
| 2334 | if (Type.fromInterned(fn_info.return_type).isError(zcu) and | 2352 | if (Type.fromInterned(fn_info.return_type).isError(zcu) and |
| 2335 | zcu.comp.config.any_error_tracing) | 2353 | zcu.comp.config.any_error_tracing) |
| 2336 | { | 2354 | { |
| 2337 | const ptr_ty = try pt.singleMutPtrType(try o.getStackTraceType()); | 2355 | const ptr_ty = try pt.singleMutPtrType(try o.getStackTraceType()); |
| 2338 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty)); | 2356 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty, required_by_runtime)); |
| 2339 | } | 2357 | } |
| 2340 | | 2358 | |
| 2341 | for (0..fn_info.param_types.len) |i| { | 2359 | for (0..fn_info.param_types.len) |i| { |
| ... | @@ -2344,9 +2362,9 @@ pub const Object = struct { | ... | @@ -2344,9 +2362,9 @@ pub const Object = struct { |
| 2344 | | 2362 | |
| 2345 | if (isByRef(param_ty, pt)) { | 2363 | if (isByRef(param_ty, pt)) { |
| 2346 | const ptr_ty = try pt.singleMutPtrType(param_ty); | 2364 | const ptr_ty = try pt.singleMutPtrType(param_ty); |
| 2347 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty)); | 2365 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(ptr_ty, required_by_runtime)); |
| 2348 | } else { | 2366 | } else { |
| 2349 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(param_ty)); | 2367 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(param_ty, required_by_runtime)); |
| 2350 | } | 2368 | } |
| 2351 | } | 2369 | } |
| 2352 | | 2370 | |
| ... | @@ -2367,421 +2385,419 @@ pub const Object = struct { | ... | @@ -2367,421 +2385,419 @@ pub const Object = struct { |
| 2367 | .Frame => @panic("TODO implement lowerDebugType for Frame types"), | 2385 | .Frame => @panic("TODO implement lowerDebugType for Frame types"), |
| 2368 | .AnyFrame => @panic("TODO implement lowerDebugType for AnyFrame types"), | 2386 | .AnyFrame => @panic("TODO implement lowerDebugType for AnyFrame types"), |
| 2369 | // These are the types that need a correct scope. | 2387 | // These are the types that need a correct scope. |
| 2370 | .Enum, | 2388 | .Enum, .Struct, .Union, .Opaque => {}, |
| 2371 | .Struct, | | |
| 2372 | .Union, | | |
| 2373 | .Opaque => {} | | |
| 2374 | } | 2389 | } |
| | 2390 | const fwd_ref = try o.builder.debugForwardReference(); |
| | 2391 | try o.debug_type_map.put(gpa, ty, fwd_ref); |
| | 2392 | try o.debug_unresolved_namespace_scopes.put(gpa, ty, required_by_runtime); |
| 2375 | | 2393 | |
| | 2394 | return fwd_ref; |
| | 2395 | } |
| 2376 | | 2396 | |
| 2377 | const owner_decl_index = ty.getOwnerDeclOrNull(zcu); | 2397 | fn genNamespaces(o: *Object) !void { |
| 2378 | const owner_decl: ?*Zcu.Decl = | 2398 | const gpa = o.gpa; |
| 2379 | if (owner_decl_index) |owner| zcu.declPtr(owner) else null; | 2399 | const pt = o.pt; |
| | 2400 | const zcu = pt.zcu; |
| | 2401 | const ip = &zcu.intern_pool; |
| 2380 | | 2402 | |
| 2381 | const file = if (owner_decl) |owner| | 2403 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; |
| 2382 | try o.getDebugFile(zcu.namespacePtr(owner.src_namespace).fileScope(zcu)) else .none; | 2404 | defer fields.deinit(gpa); |
| 2383 | const scope = if (owner_decl) |owner| | | |
| 2384 | try o.namespaceToDebugScope(owner.src_namespace) else o.debug_compile_unit; | | |
| 2385 | const line = if (owner_decl) |owner| owner.typeSrcLine(zcu) + 1 else 0; | | |
| 2386 | | 2405 | |
| | 2406 | const unresolved = &o.debug_unresolved_namespace_scopes; |
| | 2407 | var unresolved_i: usize = 0; |
| | 2408 | while (unresolved_i < unresolved.count()) : (unresolved_i += 1) { |
| | 2409 | const ty = unresolved.keys()[unresolved_i]; |
| | 2410 | const required_by_runtime = unresolved.values()[unresolved_i]; |
| 2387 | | 2411 | |
| 2388 | const name = if (owner_decl) |owner| owner.name.toSlice(ip) else try o.allocTypeName(ty); | 2412 | const owner_decl_index = ty.getOwnerDeclOrNull(zcu); |
| 2389 | defer if (owner_decl == null) gpa.free(name); | 2413 | const owner_decl: ?*Zcu.Decl = |
| | 2414 | if (owner_decl_index) |owner| ip.declPtr(owner) else null; |
| 2390 | | 2415 | |
| 2391 | switch (ty.zigTypeTag(zcu)) { | 2416 | const file = if (owner_decl) |owner| |
| 2392 | .Enum => { | 2417 | try o.getDebugFile(zcu.namespacePtr(owner.src_namespace).fileScope(zcu)) |
| 2393 | if (!ty.hasRuntimeBitsIgnoreComptime(pt)) { | 2418 | else |
| 2394 | const debug_enum_type = try o.makeEmptyNamespaceDebugType(owner_decl_index.?); | 2419 | .none; |
| 2395 | try o.debug_type_map.put(gpa, ty, debug_enum_type); | 2420 | const scope = if (owner_decl) |owner| |
| 2396 | return debug_enum_type; | 2421 | try o.namespaceToDebugScope(owner.src_namespace) |
| 2397 | } | 2422 | else |
| | 2423 | o.debug_compile_unit; |
| | 2424 | const line = if (owner_decl) |owner| owner.typeSrcLine(zcu) + 1 else 0; |
| 2398 | | 2425 | |
| 2399 | const enum_type = ip.loadEnumType(ty.toIntern()); | 2426 | const name = if (owner_decl) |owner| owner.name.toSlice(ip) else try o.allocTypeName(ty); |
| | 2427 | defer if (owner_decl == null) gpa.free(name); |
| 2400 | | 2428 | |
| 2401 | const enumerators = try gpa.alloc(Builder.Metadata, enum_type.names.len); | 2429 | const fwd_ref = o.debug_type_map.get(ty).?; |
| 2402 | defer gpa.free(enumerators); | | |
| 2403 | | 2430 | |
| 2404 | const int_ty = Type.fromInterned(enum_type.tag_ty); | 2431 | fields.clearRetainingCapacity(); |
| 2405 | const int_info = ty.intInfo(zcu); | | |
| 2406 | assert(int_info.bits != 0); | | |
| 2407 | | 2432 | |
| 2408 | for (enum_type.names.get(ip), 0..) |field_name_ip, i| { | 2433 | const ns = if (ty.getNamespace(zcu)) |n| n.unwrap() else null; |
| 2409 | var bigint_space: Value.BigIntSpace = undefined; | 2434 | if (ns) |ns_id| { |
| 2410 | const bigint = if (enum_type.values.len != 0) | 2435 | const namespace = ip.namespacePtr(ns_id); |
| 2411 | Value.fromInterned(enum_type.values.get(ip)[i]).toBigInt(&bigint_space, pt) | 2436 | try fields.ensureUnusedCapacity(gpa, namespace.decls.keys().len); |
| 2412 | else | | |
| 2413 | std.math.big.int.Mutable.init(&bigint_space.limbs, i).toConst(); | | |
| 2414 | | 2437 | |
| 2415 | enumerators[i] = try o.builder.debugEnumerator( | 2438 | for (namespace.decls.keys()) |decl_id| { |
| 2416 | try o.builder.metadataString(field_name_ip.toSlice(ip)), | 2439 | const decl = ip.declPtr(decl_id); |
| 2417 | int_info.signedness == .unsigned, | 2440 | const decl_name = decl.name.toSlice(ip); |
| 2418 | int_info.bits, | | |
| 2419 | bigint, | | |
| 2420 | ); | | |
| 2421 | } | | |
| 2422 | | 2441 | |
| 2423 | const debug_enum_type = try o.builder.debugEnumerationType( | 2442 | if (!decl.has_tv) continue; |
| 2424 | try o.builder.metadataString(name), | 2443 | if (decl.kind != .named) continue; |
| 2425 | file, | 2444 | if (decl.analysis != .complete) continue; |
| 2426 | scope, | | |
| 2427 | line, | | |
| 2428 | try o.lowerDebugType(int_ty), | | |
| 2429 | ty.abiSize(pt) * 8, | | |
| 2430 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | | |
| 2431 | try o.builder.debugTuple(enumerators), | | |
| 2432 | ); | | |
| 2433 | | 2445 | |
| 2434 | try o.debug_type_map.put(gpa, ty, debug_enum_type); | 2446 | const decl_line = decl.typeSrcLine(zcu) + 1; |
| 2435 | try o.debug_enums.append(gpa, debug_enum_type); | | |
| 2436 | return debug_enum_type; | | |
| 2437 | }, | | |
| 2438 | .Opaque => { | | |
| 2439 | if (ty.toIntern() == .anyopaque_type) { | | |
| 2440 | const debug_opaque_type = try o.builder.debugSignedType( | | |
| 2441 | try o.builder.metadataString("anyopaque"), | | |
| 2442 | 0, | | |
| 2443 | ); | | |
| 2444 | try o.debug_type_map.put(gpa, ty, debug_opaque_type); | | |
| 2445 | return debug_opaque_type; | | |
| 2446 | } | | |
| 2447 | | 2447 | |
| 2448 | const debug_opaque_type = try o.builder.debugStructType( | 2448 | if (decl.val.typeOf(zcu).ip_index == .type_type) { |
| 2449 | try o.builder.metadataString(name), | 2449 | const nested_type = decl.val.toType(); |
| 2450 | file, | 2450 | // If this decl is the owner of the type, it will |
| 2451 | scope, | 2451 | // already have been declared as a direct child and |
| 2452 | line, | 2452 | // will not need to be typedef'd. |
| 2453 | .none, // Underlying type | 2453 | if (nested_type.getOwnerDeclOrNull(zcu)) |owner| { |
| 2454 | 0, // Size | 2454 | if (owner == decl_id) continue; |
| 2455 | 0, // Align | 2455 | } |
| 2456 | .none, // Fields | 2456 | |
| 2457 | ); | 2457 | fields.appendAssumeCapacity(try o.builder.debugTypedef( |
| 2458 | try o.debug_type_map.put(gpa, ty, debug_opaque_type); | 2458 | try o.builder.metadataString(decl_name), |
| 2459 | return debug_opaque_type; | 2459 | try o.getDebugFile(namespace.fileScope(zcu)), |
| 2460 | }, | 2460 | fwd_ref, |
| 2461 | .Struct => { | 2461 | decl_line, |
| 2462 | if (zcu.typeToPackedStruct(ty)) |struct_type| { | 2462 | try o.lowerDebugType(nested_type, false), |
| 2463 | const backing_int_ty = struct_type.backingIntTypeUnordered(ip); | 2463 | 0, // Align |
| 2464 | if (backing_int_ty != .none) { | 2464 | )); |
| 2465 | const info = Type.fromInterned(backing_int_ty).intInfo(zcu); | 2465 | } else if (decl.val.getVariable(zcu)) |v| { |
| 2466 | const builder_name = try o.builder.metadataString(name); | 2466 | fields.appendAssumeCapacity(try o.builder.debugStaticMemberType( |
| 2467 | const debug_int_type = switch (info.signedness) { | 2467 | try o.builder.metadataString(decl_name), |
| 2468 | .signed => try o.builder.debugSignedType(builder_name, ty.abiSize(pt) * 8), | 2468 | try o.getDebugFile(namespace.fileScope(zcu)), |
| 2469 | .unsigned => try o.builder.debugUnsignedType(builder_name, ty.abiSize(pt) * 8), | 2469 | fwd_ref, |
| 2470 | }; | 2470 | decl_line, |
| 2471 | try o.debug_type_map.put(gpa, ty, debug_int_type); | 2471 | try o.lowerDebugType(Type.fromInterned(v.ty), false), |
| 2472 | return debug_int_type; | 2472 | )); |
| 2473 | } | 2473 | } |
| 2474 | } | 2474 | } |
| | 2475 | } |
| 2475 | | 2476 | |
| 2476 | switch (ip.indexToKey(ty.toIntern())) { | 2477 | if (!required_by_runtime) { |
| 2477 | .anon_struct_type => |tuple| { | 2478 | const res = try o.makeNamespaceDebugType(owner_decl_index.?, fields.items); |
| 2478 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2479 | o.builder.debugForwardReferenceSetType(fwd_ref, res); |
| 2479 | defer fields.deinit(gpa); | 2480 | continue; |
| 2480 | | 2481 | } |
| 2481 | try fields.ensureUnusedCapacity(gpa, tuple.types.len); | | |
| 2482 | | | |
| 2483 | comptime assert(struct_layout_version == 2); | | |
| 2484 | var offset: u64 = 0; | | |
| 2485 | | | |
| 2486 | const debug_fwd_ref = try o.builder.debugForwardReference(); | | |
| 2487 | | | |
| 2488 | for (tuple.types.get(ip), tuple.values.get(ip), 0..) |field_ty, field_val, i| { | | |
| 2489 | if (field_val != .none or !Type.fromInterned(field_ty).hasRuntimeBits(pt)) continue; | | |
| 2490 | | | |
| 2491 | const field_size = Type.fromInterned(field_ty).abiSize(pt); | | |
| 2492 | const field_align = Type.fromInterned(field_ty).abiAlignment(pt); | | |
| 2493 | const field_offset = field_align.forward(offset); | | |
| 2494 | offset = field_offset + field_size; | | |
| 2495 | | | |
| 2496 | const field_name = if (tuple.names.len != 0) | | |
| 2497 | tuple.names.get(ip)[i].toSlice(ip) | | |
| 2498 | else | | |
| 2499 | try std.fmt.allocPrintZ(gpa, "{d}", .{i}); | | |
| 2500 | defer if (tuple.names.len == 0) gpa.free(field_name); | | |
| 2501 | | | |
| 2502 | fields.appendAssumeCapacity(try o.builder.debugMemberType( | | |
| 2503 | try o.builder.metadataString(field_name), | | |
| 2504 | .none, // File | | |
| 2505 | debug_fwd_ref, | | |
| 2506 | 0, | | |
| 2507 | try o.lowerDebugType(Type.fromInterned(field_ty)), | | |
| 2508 | field_size * 8, | | |
| 2509 | (field_align.toByteUnits() orelse 0) * 8, | | |
| 2510 | field_offset * 8, | | |
| 2511 | )); | | |
| 2512 | } | | |
| 2513 | | | |
| 2514 | const debug_struct_type = try o.builder.debugStructType( | | |
| 2515 | try o.builder.metadataString(name), | | |
| 2516 | file, | | |
| 2517 | scope, | | |
| 2518 | 0, // Line | | |
| 2519 | .none, // Underlying type | | |
| 2520 | ty.abiSize(pt) * 8, | | |
| 2521 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | | |
| 2522 | try o.builder.debugTuple(fields.items), | | |
| 2523 | ); | | |
| 2524 | | 2482 | |
| 2525 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_struct_type); | 2483 | const res = switch (ty.zigTypeTag(zcu)) { |
| | 2484 | .Enum => res: { |
| | 2485 | if (!ty.hasRuntimeBitsIgnoreComptime(pt)) { |
| | 2486 | break :res try o.makeNamespaceDebugType(owner_decl_index.?, fields.items); |
| | 2487 | } |
| 2526 | | 2488 | |
| 2527 | try o.debug_type_map.put(gpa, ty, debug_struct_type); | 2489 | const enum_type = ip.loadEnumType(ty.toIntern()); |
| 2528 | return debug_struct_type; | | |
| 2529 | }, | | |
| 2530 | .struct_type => { | | |
| 2531 | if (!ip.loadStructType(ty.toIntern()).haveFieldTypes(ip)) { | | |
| 2532 | // This can happen if a struct type makes it all the way to | | |
| 2533 | // flush() without ever being instantiated or referenced (even | | |
| 2534 | // via pointer). The only reason we are hearing about it now is | | |
| 2535 | // that it is being used as a namespace to put other debug types | | |
| 2536 | // into. Therefore we can satisfy this by making an empty namespace, | | |
| 2537 | // rather than changing the frontend to unnecessarily resolve the | | |
| 2538 | // struct field types. | | |
| 2539 | const debug_struct_type = try o.makeEmptyNamespaceDebugType(owner_decl_index.?); | | |
| 2540 | try o.debug_type_map.put(gpa, ty, debug_struct_type); | | |
| 2541 | return debug_struct_type; | | |
| 2542 | } | | |
| 2543 | }, | | |
| 2544 | else => {}, | | |
| 2545 | } | | |
| 2546 | | 2490 | |
| 2547 | if (!ty.hasRuntimeBitsIgnoreComptime(pt)) { | 2491 | const enumerators = try gpa.alloc(Builder.Metadata, enum_type.names.len); |
| 2548 | const debug_struct_type = try o.makeEmptyNamespaceDebugType(owner_decl_index.?); | 2492 | defer gpa.free(enumerators); |
| 2549 | try o.debug_type_map.put(gpa, ty, debug_struct_type); | | |
| 2550 | return debug_struct_type; | | |
| 2551 | } | | |
| 2552 | | 2493 | |
| 2553 | const struct_type = zcu.typeToStruct(ty).?; | 2494 | const int_ty = Type.fromInterned(enum_type.tag_ty); |
| | 2495 | const int_info = ty.intInfo(zcu); |
| | 2496 | assert(int_info.bits != 0); |
| 2554 | | 2497 | |
| 2555 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2498 | for (enum_type.names.get(ip), 0..) |field_name_ip, i| { |
| 2556 | defer fields.deinit(gpa); | 2499 | var bigint_space: Value.BigIntSpace = undefined; |
| | 2500 | const bigint = if (enum_type.values.len != 0) |
| | 2501 | Value.fromInterned(enum_type.values.get(ip)[i]).toBigInt(&bigint_space, pt) |
| | 2502 | else |
| | 2503 | std.math.big.int.Mutable.init(&bigint_space.limbs, i).toConst(); |
| 2557 | | 2504 | |
| 2558 | try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); | 2505 | enumerators[i] = try o.builder.debugEnumerator( |
| | 2506 | try o.builder.metadataString(field_name_ip.toSlice(ip)), |
| | 2507 | int_info.signedness == .unsigned, |
| | 2508 | int_info.bits, |
| | 2509 | bigint, |
| | 2510 | ); |
| | 2511 | } |
| 2559 | | 2512 | |
| 2560 | const debug_fwd_ref = try o.builder.debugForwardReference(); | 2513 | const debug_enum_type = try o.builder.debugEnumerationType( |
| | 2514 | try o.builder.metadataString(name), |
| | 2515 | file, |
| | 2516 | scope, |
| | 2517 | line, |
| | 2518 | try o.lowerDebugType(int_ty, required_by_runtime), |
| | 2519 | ty.abiSize(pt) * 8, |
| | 2520 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| | 2521 | try o.builder.debugTuple(enumerators), |
| | 2522 | ); |
| 2561 | | 2523 | |
| 2562 | // Set as forward reference while the type is lowered in case it references itself | 2524 | try o.debug_enums.append(gpa, debug_enum_type); |
| 2563 | try o.debug_type_map.put(gpa, ty, debug_fwd_ref); | 2525 | break :res debug_enum_type; |
| | 2526 | }, |
| | 2527 | .Opaque => res: { |
| | 2528 | if (ty.toIntern() == .anyopaque_type) { |
| | 2529 | break :res try o.builder.debugSignedType( |
| | 2530 | try o.builder.metadataString("anyopaque"), |
| | 2531 | 0, |
| | 2532 | ); |
| | 2533 | } |
| 2564 | | 2534 | |
| 2565 | comptime assert(struct_layout_version == 2); | 2535 | const debug_opaque_type = try o.builder.debugStructType( |
| 2566 | var it = struct_type.iterateRuntimeOrder(ip); | 2536 | try o.builder.metadataString(name), |
| 2567 | while (it.next()) |field_index| { | 2537 | file, |
| 2568 | const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[field_index]); | 2538 | scope, |
| 2569 | if (!field_ty.hasRuntimeBitsIgnoreComptime(pt)) continue; | 2539 | line, |
| 2570 | const field_size = field_ty.abiSize(pt); | 2540 | .none, // Underlying type |
| 2571 | const field_align = pt.structFieldAlignment( | 2541 | 0, // Size |
| 2572 | struct_type.fieldAlign(ip, field_index), | 2542 | 0, // Align |
| 2573 | field_ty, | 2543 | .none, // Fields |
| 2574 | struct_type.layout, | | |
| 2575 | ); | 2544 | ); |
| 2576 | const field_offset = ty.structFieldOffset(field_index, pt); | 2545 | break :res debug_opaque_type; |
| | 2546 | }, |
| | 2547 | .Struct => res: { |
| | 2548 | if (zcu.typeToPackedStruct(ty)) |struct_type| { |
| | 2549 | const backing_int_ty = struct_type.backingIntTypeUnordered(ip); |
| | 2550 | if (backing_int_ty != .none) { |
| | 2551 | const info = Type.fromInterned(backing_int_ty).intInfo(zcu); |
| | 2552 | const builder_name = try o.builder.metadataString(name); |
| | 2553 | const debug_int_type = switch (info.signedness) { |
| | 2554 | .signed => try o.builder.debugSignedType(builder_name, ty.abiSize(pt) * 8), |
| | 2555 | .unsigned => try o.builder.debugUnsignedType(builder_name, ty.abiSize(pt) * 8), |
| | 2556 | }; |
| | 2557 | break :res debug_int_type; |
| | 2558 | } |
| | 2559 | } |
| 2577 | | 2560 | |
| 2578 | const field_name = struct_type.fieldName(ip, field_index).unwrap() orelse | 2561 | switch (ip.indexToKey(ty.toIntern())) { |
| 2579 | try ip.getOrPutStringFmt(gpa, pt.tid, "{d}", .{field_index}, .no_embedded_nulls); | 2562 | .anon_struct_type => |tuple| { |
| | 2563 | try fields.ensureUnusedCapacity(gpa, tuple.types.len); |
| | 2564 | |
| | 2565 | comptime assert(struct_layout_version == 2); |
| | 2566 | var offset: u64 = 0; |
| | 2567 | |
| | 2568 | for (tuple.types.get(ip), tuple.values.get(ip), 0..) |field_ty, field_val, i| { |
| | 2569 | if (field_val != .none or !Type.fromInterned(field_ty).hasRuntimeBits(pt)) continue; |
| | 2570 | |
| | 2571 | const field_size = Type.fromInterned(field_ty).abiSize(pt); |
| | 2572 | const field_align = Type.fromInterned(field_ty).abiAlignment(pt); |
| | 2573 | const field_offset = field_align.forward(offset); |
| | 2574 | offset = field_offset + field_size; |
| | 2575 | |
| | 2576 | const field_name = if (tuple.names.len != 0) |
| | 2577 | tuple.names.get(ip)[i].toSlice(ip) |
| | 2578 | else |
| | 2579 | try std.fmt.allocPrintZ(gpa, "{d}", .{i}); |
| | 2580 | defer if (tuple.names.len == 0) gpa.free(field_name); |
| | 2581 | |
| | 2582 | fields.appendAssumeCapacity(try o.builder.debugMemberType( |
| | 2583 | try o.builder.metadataString(field_name), |
| | 2584 | .none, // File |
| | 2585 | fwd_ref, |
| | 2586 | 0, |
| | 2587 | try o.lowerDebugType(Type.fromInterned(field_ty), required_by_runtime), |
| | 2588 | field_size * 8, |
| | 2589 | (field_align.toByteUnits() orelse 0) * 8, |
| | 2590 | field_offset * 8, |
| | 2591 | )); |
| | 2592 | } |
| 2580 | | 2593 | |
| 2581 | fields.appendAssumeCapacity(try o.builder.debugMemberType( | 2594 | const debug_struct_type = try o.builder.debugStructType( |
| 2582 | try o.builder.metadataString(field_name.toSlice(ip)), | 2595 | try o.builder.metadataString(name), |
| 2583 | file, | 2596 | file, |
| 2584 | debug_fwd_ref, | 2597 | scope, |
| 2585 | 0, // Line | 2598 | 0, // Line |
| 2586 | try o.lowerDebugType(field_ty), | 2599 | .none, // Underlying type |
| 2587 | field_size * 8, | 2600 | ty.abiSize(pt) * 8, |
| 2588 | (field_align.toByteUnits() orelse 0) * 8, | 2601 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| 2589 | field_offset * 8, | 2602 | try o.builder.debugTuple(fields.items), |
| 2590 | )); | 2603 | ); |
| 2591 | } | | |
| 2592 | | 2604 | |
| 2593 | const debug_struct_type = try o.builder.debugStructType( | 2605 | break :res debug_struct_type; |
| 2594 | try o.builder.metadataString(name), | 2606 | }, |
| 2595 | file, | 2607 | else => {}, |
| 2596 | scope, | 2608 | } |
| 2597 | line, | | |
| 2598 | .none, // Underlying type | | |
| 2599 | ty.abiSize(pt) * 8, | | |
| 2600 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | | |
| 2601 | try o.builder.debugTuple(fields.items), | | |
| 2602 | ); | | |
| 2603 | | 2609 | |
| 2604 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_struct_type); | 2610 | if (!ty.hasRuntimeBitsIgnoreComptime(pt)) { |
| | 2611 | break :res try o.makeNamespaceDebugType(owner_decl_index.?, fields.items); |
| | 2612 | } |
| | 2613 | const struct_type = zcu.typeToStruct(ty).?; |
| 2605 | | 2614 | |
| 2606 | // Set to real type now that it has been lowered fully | 2615 | if (!struct_type.haveLayout(ip) or !struct_type.haveFieldTypes(ip)) { |
| 2607 | const map_ptr = o.debug_type_map.getPtr(ty) orelse unreachable; | 2616 | break :res try o.makeNamespaceDebugType(owner_decl_index.?, fields.items); |
| 2608 | map_ptr.* = debug_struct_type; | 2617 | } |
| 2609 | | 2618 | |
| 2610 | return debug_struct_type; | 2619 | try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); |
| 2611 | }, | | |
| 2612 | .Union => { | | |
| 2613 | const union_type = ip.loadUnionType(ty.toIntern()); | | |
| 2614 | if (!union_type.haveFieldTypes(ip) or | | |
| 2615 | !ty.hasRuntimeBitsIgnoreComptime(pt) or | | |
| 2616 | !union_type.haveLayout(ip)) | | |
| 2617 | { | | |
| 2618 | const debug_union_type = try o.makeEmptyNamespaceDebugType(owner_decl_index.?); | | |
| 2619 | try o.debug_type_map.put(gpa, ty, debug_union_type); | | |
| 2620 | return debug_union_type; | | |
| 2621 | } | | |
| 2622 | | 2620 | |
| 2623 | const layout = pt.getUnionLayout(union_type); | 2621 | comptime assert(struct_layout_version == 2); |
| | 2622 | var it = struct_type.iterateRuntimeOrder(ip); |
| | 2623 | while (it.next()) |field_index| { |
| | 2624 | const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[field_index]); |
| | 2625 | if (!field_ty.hasRuntimeBitsIgnoreComptime(pt)) continue; |
| | 2626 | const field_size = field_ty.abiSize(pt); |
| | 2627 | const field_align = pt.structFieldAlignment( |
| | 2628 | struct_type.fieldAlign(ip, field_index), |
| | 2629 | field_ty, |
| | 2630 | struct_type.layout, |
| | 2631 | ); |
| | 2632 | const field_offset = ty.structFieldOffset(field_index, pt); |
| 2624 | | 2633 | |
| 2625 | const debug_fwd_ref = try o.builder.debugForwardReference(); | 2634 | const field_name = struct_type.fieldName(ip, field_index).unwrap() orelse |
| | 2635 | try ip.getOrPutStringFmt(gpa, pt.tid, "{d}", .{field_index}, .no_embedded_nulls); |
| 2626 | | 2636 | |
| 2627 | // Set as forward reference while the type is lowered in case it references itself | 2637 | fields.appendAssumeCapacity(try o.builder.debugMemberType( |
| 2628 | try o.debug_type_map.put(gpa, ty, debug_fwd_ref); | 2638 | try o.builder.metadataString(field_name.toSlice(ip)), |
| | 2639 | file, |
| | 2640 | fwd_ref, |
| | 2641 | 0, // Line |
| | 2642 | try o.lowerDebugType(field_ty, required_by_runtime), |
| | 2643 | field_size * 8, |
| | 2644 | (field_align.toByteUnits() orelse 0) * 8, |
| | 2645 | field_offset * 8, |
| | 2646 | )); |
| | 2647 | } |
| 2629 | | 2648 | |
| 2630 | if (layout.payload_size == 0) { | 2649 | const debug_struct_type = try o.builder.debugStructType( |
| 2631 | const debug_union_type = try o.builder.debugStructType( | | |
| 2632 | try o.builder.metadataString(name), | 2650 | try o.builder.metadataString(name), |
| 2633 | file, | 2651 | file, |
| 2634 | scope, | 2652 | scope, |
| 2635 | 0, // Line | 2653 | line, |
| 2636 | .none, // Underlying type | 2654 | .none, // Underlying type |
| 2637 | ty.abiSize(pt) * 8, | 2655 | ty.abiSize(pt) * 8, |
| 2638 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | 2656 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| 2639 | try o.builder.debugTuple( | 2657 | try o.builder.debugTuple(fields.items), |
| 2640 | &.{try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty))}, | | |
| 2641 | ), | | |
| 2642 | ); | 2658 | ); |
| 2643 | | 2659 | |
| 2644 | // Set to real type now that it has been lowered fully | 2660 | break :res debug_struct_type; |
| 2645 | const map_ptr = o.debug_type_map.getPtr(ty) orelse unreachable; | 2661 | }, |
| 2646 | map_ptr.* = debug_union_type; | 2662 | .Union => res: { |
| 2647 | | 2663 | const union_type = ip.loadUnionType(ty.toIntern()); |
| 2648 | return debug_union_type; | 2664 | if (!union_type.haveFieldTypes(ip) or |
| 2649 | } | 2665 | !ty.hasRuntimeBitsIgnoreComptime(pt) or |
| 2650 | | 2666 | !union_type.haveLayout(ip)) |
| 2651 | var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; | 2667 | { |
| 2652 | defer fields.deinit(gpa); | 2668 | break :res try o.makeNamespaceDebugType(owner_decl_index.?, fields.items); |
| 2653 | | 2669 | } |
| 2654 | try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); | | |
| 2655 | | | |
| 2656 | const debug_union_fwd_ref = if (layout.tag_size == 0) | | |
| 2657 | debug_fwd_ref | | |
| 2658 | else | | |
| 2659 | try o.builder.debugForwardReference(); | | |
| 2660 | | 2670 | |
| 2661 | const tag_type = union_type.loadTagType(ip); | 2671 | const layout = pt.getUnionLayout(union_type); |
| 2662 | | 2672 | |
| 2663 | for (0..tag_type.names.len) |field_index| { | 2673 | if (layout.payload_size == 0) { |
| 2664 | const field_ty = union_type.field_types.get(ip)[field_index]; | 2674 | const debug_union_type = try o.builder.debugStructType( |
| 2665 | if (!Type.fromInterned(field_ty).hasRuntimeBitsIgnoreComptime(pt)) continue; | 2675 | try o.builder.metadataString(name), |
| | 2676 | file, |
| | 2677 | scope, |
| | 2678 | 0, // Line |
| | 2679 | .none, // Underlying type |
| | 2680 | ty.abiSize(pt) * 8, |
| | 2681 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| | 2682 | try o.builder.debugTuple( |
| | 2683 | &.{try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty), required_by_runtime)}, |
| | 2684 | ), |
| | 2685 | ); |
| 2666 | | 2686 | |
| 2667 | const field_size = Type.fromInterned(field_ty).abiSize(pt); | 2687 | break :res debug_union_type; |
| 2668 | const field_align: InternPool.Alignment = switch (union_type.flagsUnordered(ip).layout) { | 2688 | } |
| 2669 | .@"packed" => .none, | | |
| 2670 | .auto, .@"extern" => pt.unionFieldNormalAlignment(union_type, @intCast(field_index)), | | |
| 2671 | }; | | |
| 2672 | | 2689 | |
| 2673 | const field_name = tag_type.names.get(ip)[field_index]; | 2690 | try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); |
| 2674 | fields.appendAssumeCapacity(try o.builder.debugMemberType( | | |
| 2675 | try o.builder.metadataString(field_name.toSlice(ip)), | | |
| 2676 | file, | | |
| 2677 | debug_union_fwd_ref, | | |
| 2678 | 0, // Line | | |
| 2679 | try o.lowerDebugType(Type.fromInterned(field_ty)), | | |
| 2680 | field_size * 8, | | |
| 2681 | (field_align.toByteUnits() orelse 0) * 8, | | |
| 2682 | 0, // Offset | | |
| 2683 | )); | | |
| 2684 | } | | |
| 2685 | | 2691 | |
| 2686 | var union_name_buf: ?[:0]const u8 = null; | 2692 | const debug_union_fwd_ref = if (layout.tag_size == 0) |
| 2687 | defer if (union_name_buf) |buf| gpa.free(buf); | 2693 | fwd_ref |
| 2688 | const union_name = if (layout.tag_size == 0) name else name: { | 2694 | else |
| 2689 | union_name_buf = try std.fmt.allocPrintZ(gpa, "{s}:Payload", .{name}); | 2695 | try o.builder.debugForwardReference(); |
| 2690 | break :name union_name_buf.?; | | |
| 2691 | }; | | |
| 2692 | | 2696 | |
| 2693 | const debug_union_type = try o.builder.debugUnionType( | 2697 | const tag_type = union_type.loadTagType(ip); |
| 2694 | try o.builder.metadataString(union_name), | | |
| 2695 | file, | | |
| 2696 | scope, | | |
| 2697 | line, | | |
| 2698 | .none, // Underlying type | | |
| 2699 | ty.abiSize(pt) * 8, | | |
| 2700 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | | |
| 2701 | try o.builder.debugTuple(fields.items), | | |
| 2702 | ); | | |
| 2703 | | 2698 | |
| 2704 | o.builder.debugForwardReferenceSetType(debug_union_fwd_ref, debug_union_type); | 2699 | for (0..tag_type.names.len) |field_index| { |
| | 2700 | const field_ty = union_type.field_types.get(ip)[field_index]; |
| | 2701 | if (!Type.fromInterned(field_ty).hasRuntimeBitsIgnoreComptime(pt)) continue; |
| 2705 | | 2702 | |
| 2706 | if (layout.tag_size == 0) { | 2703 | const field_size = Type.fromInterned(field_ty).abiSize(pt); |
| 2707 | // Set to real type now that it has been lowered fully | 2704 | const field_align: InternPool.Alignment = switch (union_type.flagsUnordered(ip).layout) { |
| 2708 | const map_ptr = o.debug_type_map.getPtr(ty) orelse unreachable; | 2705 | .@"packed" => .none, |
| 2709 | map_ptr.* = debug_union_type; | 2706 | .auto, .@"extern" => pt.unionFieldNormalAlignment(union_type, @intCast(field_index)), |
| | 2707 | }; |
| 2710 | | 2708 | |
| 2711 | return debug_union_type; | 2709 | const field_name = tag_type.names.get(ip)[field_index]; |
| 2712 | } | 2710 | fields.appendAssumeCapacity(try o.builder.debugMemberType( |
| | 2711 | try o.builder.metadataString(field_name.toSlice(ip)), |
| | 2712 | file, |
| | 2713 | debug_union_fwd_ref, |
| | 2714 | 0, // Line |
| | 2715 | try o.lowerDebugType(Type.fromInterned(field_ty), required_by_runtime), |
| | 2716 | field_size * 8, |
| | 2717 | (field_align.toByteUnits() orelse 0) * 8, |
| | 2718 | 0, // Offset |
| | 2719 | )); |
| | 2720 | } |
| 2713 | | 2721 | |
| 2714 | var tag_offset: u64 = undefined; | 2722 | var union_name_buf: ?[:0]const u8 = null; |
| 2715 | var payload_offset: u64 = undefined; | 2723 | defer if (union_name_buf) |buf| gpa.free(buf); |
| 2716 | if (layout.tag_align.compare(.gte, layout.payload_align)) { | 2724 | const union_name = if (layout.tag_size == 0) name else name: { |
| 2717 | tag_offset = 0; | 2725 | union_name_buf = try std.fmt.allocPrintZ(gpa, "{s}:Payload", .{name}); |
| 2718 | payload_offset = layout.payload_align.forward(layout.tag_size); | 2726 | break :name union_name_buf.?; |
| 2719 | } else { | 2727 | }; |
| 2720 | payload_offset = 0; | | |
| 2721 | tag_offset = layout.tag_align.forward(layout.payload_size); | | |
| 2722 | } | | |
| 2723 | | 2728 | |
| 2724 | const debug_tag_type = try o.builder.debugMemberType( | 2729 | const debug_union_type = try o.builder.debugUnionType( |
| 2725 | try o.builder.metadataString("tag"), | 2730 | try o.builder.metadataString(union_name), |
| 2726 | file, // File | 2731 | file, |
| 2727 | debug_fwd_ref, | 2732 | scope, |
| 2728 | 0, // Line | 2733 | line, |
| 2729 | try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty)), | 2734 | .none, // Underlying type |
| 2730 | layout.tag_size * 8, | 2735 | ty.abiSize(pt) * 8, |
| 2731 | (layout.tag_align.toByteUnits() orelse 0) * 8, | 2736 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| 2732 | tag_offset * 8, | 2737 | try o.builder.debugTuple(fields.items), |
| 2733 | ); | 2738 | ); |
| 2734 | | 2739 | |
| 2735 | const debug_payload_type = try o.builder.debugMemberType( | 2740 | if (layout.tag_size == 0) { |
| 2736 | try o.builder.metadataString("payload"), | 2741 | break :res debug_union_type; |
| 2737 | file, | 2742 | } |
| 2738 | debug_fwd_ref, | | |
| 2739 | 0, // Line | | |
| 2740 | debug_union_type, | | |
| 2741 | layout.payload_size * 8, | | |
| 2742 | (layout.payload_align.toByteUnits() orelse 0) * 8, | | |
| 2743 | payload_offset * 8, | | |
| 2744 | ); | | |
| 2745 | | 2743 | |
| 2746 | const full_fields: [2]Builder.Metadata = | 2744 | o.builder.debugForwardReferenceSetType(debug_union_fwd_ref, debug_union_type); |
| 2747 | if (layout.tag_align.compare(.gte, layout.payload_align)) | | |
| 2748 | .{ debug_tag_type, debug_payload_type } | | |
| 2749 | else | | |
| 2750 | .{ debug_payload_type, debug_tag_type }; | | |
| 2751 | | 2745 | |
| 2752 | const debug_tagged_union_type = try o.builder.debugStructType( | 2746 | var tag_offset: u64 = undefined; |
| 2753 | try o.builder.metadataString(name), | 2747 | var payload_offset: u64 = undefined; |
| 2754 | file, // File | 2748 | if (layout.tag_align.compare(.gte, layout.payload_align)) { |
| 2755 | scope, | 2749 | tag_offset = 0; |
| 2756 | line, | 2750 | payload_offset = layout.payload_align.forward(layout.tag_size); |
| 2757 | .none, // Underlying type | 2751 | } else { |
| 2758 | ty.abiSize(pt) * 8, | 2752 | payload_offset = 0; |
| 2759 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, | 2753 | tag_offset = layout.tag_align.forward(layout.payload_size); |
| 2760 | try o.builder.debugTuple(&full_fields), | 2754 | } |
| 2761 | ); | | |
| 2762 | | 2755 | |
| 2763 | o.builder.debugForwardReferenceSetType(debug_fwd_ref, debug_tagged_union_type); | 2756 | const debug_tag_type = try o.builder.debugMemberType( |
| | 2757 | try o.builder.metadataString("tag"), |
| | 2758 | file, // File |
| | 2759 | fwd_ref, |
| | 2760 | 0, // Line |
| | 2761 | try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty), required_by_runtime), |
| | 2762 | layout.tag_size * 8, |
| | 2763 | (layout.tag_align.toByteUnits() orelse 0) * 8, |
| | 2764 | tag_offset * 8, |
| | 2765 | ); |
| 2764 | | 2766 | |
| 2765 | // Set to real type now that it has been lowered fully | 2767 | const debug_payload_type = try o.builder.debugMemberType( |
| 2766 | const map_ptr = o.debug_type_map.getPtr(ty) orelse unreachable; | 2768 | try o.builder.metadataString("payload"), |
| 2767 | map_ptr.* = debug_tagged_union_type; | 2769 | file, |
| | 2770 | fwd_ref, |
| | 2771 | 0, // Line |
| | 2772 | debug_union_type, |
| | 2773 | layout.payload_size * 8, |
| | 2774 | (layout.payload_align.toByteUnits() orelse 0) * 8, |
| | 2775 | payload_offset * 8, |
| | 2776 | ); |
| 2768 | | 2777 | |
| 2769 | return debug_tagged_union_type; | 2778 | const full_fields: [2]Builder.Metadata = |
| 2770 | }, | 2779 | if (layout.tag_align.compare(.gte, layout.payload_align)) |
| 2771 | else => unreachable, // Handled above. | 2780 | .{ debug_tag_type, debug_payload_type } |
| 2772 | } | 2781 | else |
| 2773 | } | 2782 | .{ debug_payload_type, debug_tag_type }; |
| 2774 | | 2783 | |
| 2775 | fn genNamespaces(o: *Object) !void { | 2784 | const debug_tagged_union_type = try o.builder.debugStructType( |
| 2776 | var i: usize = 0; | 2785 | try o.builder.metadataString(name), |
| 2777 | while (i < o.debug_unresolved_namespace_scopes.count()) : (i += 1) { | 2786 | file, // File |
| 2778 | const namespace_index = o.debug_unresolved_namespace_scopes.keys()[i]; | 2787 | scope, |
| 2779 | const fwd_ref = o.debug_unresolved_namespace_scopes.values()[i]; | 2788 | line, |
| | 2789 | .none, // Underlying type |
| | 2790 | ty.abiSize(pt) * 8, |
| | 2791 | (ty.abiAlignment(pt).toByteUnits() orelse 0) * 8, |
| | 2792 | try o.builder.debugTuple(&full_fields), |
| | 2793 | ); |
| 2780 | | 2794 | |
| 2781 | const namespace = o.pt.zcu.namespacePtr(namespace_index); | 2795 | break :res debug_tagged_union_type; |
| 2782 | const debug_type = try o.lowerDebugType(namespace.getType(o.pt.zcu)); | 2796 | }, |
| | 2797 | else => unreachable, // Handled above. |
| | 2798 | }; |
| 2783 | | 2799 | |
| 2784 | o.builder.debugForwardReferenceSetType(fwd_ref, debug_type); | 2800 | o.builder.debugForwardReferenceSetType(fwd_ref, res); |
| 2785 | } | 2801 | } |
| 2786 | } | 2802 | } |
| 2787 | | 2803 | |
| ... | @@ -2791,14 +2807,10 @@ pub const Object = struct { | ... | @@ -2791,14 +2807,10 @@ pub const Object = struct { |
| 2791 | const file_scope = namespace.fileScope(zcu); | 2807 | const file_scope = namespace.fileScope(zcu); |
| 2792 | if (namespace.parent == .none) return try o.getDebugFile(file_scope); | 2808 | if (namespace.parent == .none) return try o.getDebugFile(file_scope); |
| 2793 | | 2809 | |
| 2794 | const gop = try o.debug_unresolved_namespace_scopes.getOrPut(o.gpa, namespace_index); | 2810 | return o.lowerDebugType(zcu.declPtr(namespace.decl_index).val.toType(), false); |
| 2795 | | | |
| 2796 | if (!gop.found_existing) gop.value_ptr.* = try o.builder.debugForwardReference(); | | |
| 2797 | | | |
| 2798 | return gop.value_ptr.*; | | |
| 2799 | } | 2811 | } |
| 2800 | | 2812 | |
| 2801 | fn makeEmptyNamespaceDebugType(o: *Object, decl_index: InternPool.DeclIndex) !Builder.Metadata { | 2813 | fn makeNamespaceDebugType(o: *Object, decl_index: InternPool.DeclIndex, fields: []const Builder.Metadata) !Builder.Metadata { |
| 2802 | const zcu = o.pt.zcu; | 2814 | const zcu = o.pt.zcu; |
| 2803 | const decl = zcu.declPtr(decl_index); | 2815 | const decl = zcu.declPtr(decl_index); |
| 2804 | const file_scope = zcu.namespacePtr(decl.src_namespace).fileScope(zcu); | 2816 | const file_scope = zcu.namespacePtr(decl.src_namespace).fileScope(zcu); |
| ... | @@ -2810,7 +2822,7 @@ pub const Object = struct { | ... | @@ -2810,7 +2822,7 @@ pub const Object = struct { |
| 2810 | .none, | 2822 | .none, |
| 2811 | 0, | 2823 | 0, |
| 2812 | 0, | 2824 | 0, |
| 2813 | .none, | 2825 | if (fields.len == 0) .none else try o.builder.debugTuple(fields), |
| 2814 | ); | 2826 | ); |
| 2815 | } | 2827 | } |
| 2816 | | 2828 | |
| ... | @@ -4723,6 +4735,7 @@ pub const DeclGen = struct { | ... | @@ -4723,6 +4735,7 @@ pub const DeclGen = struct { |
| 4723 | | 4735 | |
| 4724 | if (!owner_mod.strip) { | 4736 | if (!owner_mod.strip) { |
| 4725 | const debug_file = try o.getDebugFile(file_scope); | 4737 | const debug_file = try o.getDebugFile(file_scope); |
| | 4738 | const debug_scope = try o.namespaceToDebugScope(decl.src_namespace); |
| 4726 | | 4739 | |
| 4727 | const linkage_name = try o.builder.metadataStringFromStrtabString(variable_index.name(&o.builder)); | 4740 | const linkage_name = try o.builder.metadataStringFromStrtabString(variable_index.name(&o.builder)); |
| 4728 | | 4741 | |
| ... | @@ -4730,10 +4743,10 @@ pub const DeclGen = struct { | ... | @@ -4730,10 +4743,10 @@ pub const DeclGen = struct { |
| 4730 | // Imitate a C++ static member variable since neither | 4743 | // Imitate a C++ static member variable since neither |
| 4731 | // GDB or LLDB can really cope with regular variables | 4744 | // GDB or LLDB can really cope with regular variables |
| 4732 | // directly inside a struct type. | 4745 | // directly inside a struct type. |
| 4733 | const ty = try o.lowerDebugType(decl.typeOf(zcu)); | 4746 | const ty = try o.lowerDebugType(decl.typeOf(zcu), true); |
| 4734 | const name = try o.builder.metadataString(decl.name.toSlice(ip)); | 4747 | const name = try o.builder.metadataString(decl.name.toSlice(ip)); |
| 4735 | | 4748 | |
| 4736 | break :blk try o.builder.debugGlobalVar( | 4749 | const variable = try o.builder.debugGlobalVar( |
| 4737 | name, | 4750 | name, |
| 4738 | linkage_name, | 4751 | linkage_name, |
| 4739 | debug_file, | 4752 | debug_file, |
| ... | @@ -4742,15 +4755,25 @@ pub const DeclGen = struct { | ... | @@ -4742,15 +4755,25 @@ pub const DeclGen = struct { |
| 4742 | ty, | 4755 | ty, |
| 4743 | variable_index, | 4756 | variable_index, |
| 4744 | .none, | 4757 | .none, |
| 4745 | .internal, | 4758 | .external, |
| 4746 | ); | 4759 | ); |
| | 4760 | |
| | 4761 | try o.debug_imports.append(o.gpa, try o.builder.debugImportDeclaration( |
| | 4762 | name, |
| | 4763 | debug_file, |
| | 4764 | debug_scope, |
| | 4765 | line_number, |
| | 4766 | variable, |
| | 4767 | )); |
| | 4768 | |
| | 4769 | break :blk variable; |
| 4747 | } else try o.builder.debugGlobalVar( | 4770 | } else try o.builder.debugGlobalVar( |
| 4748 | linkage_name, | 4771 | linkage_name, |
| 4749 | linkage_name, | 4772 | linkage_name, |
| 4750 | debug_file, | 4773 | debug_file, |
| 4751 | debug_file, | 4774 | debug_file, |
| 4752 | line_number, | 4775 | line_number, |
| 4753 | try o.lowerDebugType(decl.typeOf(zcu)), | 4776 | try o.lowerDebugType(decl.typeOf(zcu), true), |
| 4754 | variable_index, | 4777 | variable_index, |
| 4755 | .none, | 4778 | .none, |
| 4756 | .external, | 4779 | .external, |
| ... | @@ -5209,7 +5232,7 @@ pub const FuncGen = struct { | ... | @@ -5209,7 +5232,7 @@ pub const FuncGen = struct { |
| 5209 | try o.builder.metadataString(decl.fqn.toSlice(&zcu.intern_pool)), | 5232 | try o.builder.metadataString(decl.fqn.toSlice(&zcu.intern_pool)), |
| 5210 | line_number, | 5233 | line_number, |
| 5211 | line_number + func.lbrace_line, | 5234 | line_number + func.lbrace_line, |
| 5212 | try o.lowerDebugType(fn_ty), | 5235 | try o.lowerDebugType(fn_ty, true), |
| 5213 | .{ | 5236 | .{ |
| 5214 | .di_flags = .{ .StaticMember = true }, | 5237 | .di_flags = .{ .StaticMember = true }, |
| 5215 | .sp_flags = .{ | 5238 | .sp_flags = .{ |
| ... | @@ -6759,7 +6782,7 @@ pub const FuncGen = struct { | ... | @@ -6759,7 +6782,7 @@ pub const FuncGen = struct { |
| 6759 | self.file, | 6782 | self.file, |
| 6760 | self.scope, | 6783 | self.scope, |
| 6761 | self.prev_dbg_line, | 6784 | self.prev_dbg_line, |
| 6762 | try o.lowerDebugType(ptr_ty.childType(mod)), | 6785 | try o.lowerDebugType(ptr_ty.childType(mod), true), |
| 6763 | ); | 6786 | ); |
| 6764 | | 6787 | |
| 6765 | _ = try self.wip.callIntrinsic( | 6788 | _ = try self.wip.callIntrinsic( |
| ... | @@ -6792,7 +6815,7 @@ pub const FuncGen = struct { | ... | @@ -6792,7 +6815,7 @@ pub const FuncGen = struct { |
| 6792 | self.file, | 6815 | self.file, |
| 6793 | self.scope, | 6816 | self.scope, |
| 6794 | self.prev_dbg_line, | 6817 | self.prev_dbg_line, |
| 6795 | try o.lowerDebugType(operand_ty), | 6818 | try o.lowerDebugType(operand_ty, true), |
| 6796 | ); | 6819 | ); |
| 6797 | | 6820 | |
| 6798 | const pt = o.pt; | 6821 | const pt = o.pt; |
| ... | @@ -8906,7 +8929,7 @@ pub const FuncGen = struct { | ... | @@ -8906,7 +8929,7 @@ pub const FuncGen = struct { |
| 8906 | self.file, | 8929 | self.file, |
| 8907 | self.scope, | 8930 | self.scope, |
| 8908 | lbrace_line, | 8931 | lbrace_line, |
| 8909 | try o.lowerDebugType(inst_ty), | 8932 | try o.lowerDebugType(inst_ty, true), |
| 8910 | @intCast(self.arg_index), | 8933 | @intCast(self.arg_index), |
| 8911 | ); | 8934 | ); |
| 8912 | | 8935 | |