authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-06-11 00:15:08-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-11 03:01:17-07:00
logb9a4eae34900958bad7d477cfde1e7ddb4f8be92
treee08c3f5cf4f857252b727c06077e51b78afcfea4
parenta01bc7776fe3d987e7e9e6346c43480ac260c40e

llvm: fix more name lifetimes

Hopefully this also fixes the non-reproducing CI failures.

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

src/codegen/llvm.zig+7-5
...@@ -2198,6 +2198,7 @@ pub const Object = struct {...@@ -2198,6 +2198,7 @@ pub const Object = struct {
2198 const field_size = field.ty.abiSize(mod);2198 const field_size = field.ty.abiSize(mod);
2199 const field_align = field.normalAlignment(mod);2199 const field_align = field.normalAlignment(mod);
22002200
2201 const field_di_ty = try o.lowerDebugType(field.ty, .full);
2201 di_fields.appendAssumeCapacity(dib.createMemberType(2202 di_fields.appendAssumeCapacity(dib.createMemberType(
2202 fwd_decl.toScope(),2203 fwd_decl.toScope(),
2203 mod.intern_pool.stringToSlice(field_name),2204 mod.intern_pool.stringToSlice(field_name),
...@@ -2207,7 +2208,7 @@ pub const Object = struct {...@@ -2207,7 +2208,7 @@ pub const Object = struct {
2207 field_align * 8, // align in bits2208 field_align * 8, // align in bits
2208 0, // offset in bits2209 0, // offset in bits
2209 0, // flags2210 0, // flags
2210 try o.lowerDebugType(field.ty, .full),2211 field_di_ty,
2211 ));2212 ));
2212 }2213 }
22132214
...@@ -2377,8 +2378,9 @@ pub const Object = struct {...@@ -2377,8 +2378,9 @@ pub const Object = struct {
2377 const mod = o.module;2378 const mod = o.module;
2378 const decl = mod.declPtr(decl_index);2379 const decl = mod.declPtr(decl_index);
2379 const fields: [0]*llvm.DIType = .{};2380 const fields: [0]*llvm.DIType = .{};
2381 const di_scope = try o.namespaceToDebugScope(decl.src_namespace);
2380 return o.di_builder.?.createStructType(2382 return o.di_builder.?.createStructType(
2381 try o.namespaceToDebugScope(decl.src_namespace),2383 di_scope,
2382 mod.intern_pool.stringToSlice(decl.name), // TODO use fully qualified name2384 mod.intern_pool.stringToSlice(decl.name), // TODO use fully qualified name
2383 try o.getDIFile(o.gpa, mod.namespacePtr(decl.src_namespace).file_scope),2385 try o.getDIFile(o.gpa, mod.namespacePtr(decl.src_namespace).file_scope),
2384 decl.src_line + 1,2386 decl.src_line + 1,
...@@ -5940,8 +5942,6 @@ pub const FuncGen = struct {...@@ -5940,8 +5942,6 @@ pub const FuncGen = struct {
5940 .base_line = self.base_line,5942 .base_line = self.base_line,
5941 });5943 });
59425944
5943 const fqn = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod));
5944
5945 const is_internal_linkage = !mod.decl_exports.contains(decl_index);5945 const is_internal_linkage = !mod.decl_exports.contains(decl_index);
5946 const fn_ty = try mod.funcType(.{5946 const fn_ty = try mod.funcType(.{
5947 .param_types = &.{},5947 .param_types = &.{},
...@@ -5958,13 +5958,15 @@ pub const FuncGen = struct {...@@ -5958,13 +5958,15 @@ pub const FuncGen = struct {
5958 .section_is_generic = false,5958 .section_is_generic = false,
5959 .addrspace_is_generic = false,5959 .addrspace_is_generic = false,
5960 });5960 });
5961 const fn_di_ty = try self.dg.object.lowerDebugType(fn_ty, .full);
5962 const fqn = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod));
5961 const subprogram = dib.createFunction(5963 const subprogram = dib.createFunction(
5962 di_file.toScope(),5964 di_file.toScope(),
5963 mod.intern_pool.stringToSlice(decl.name),5965 mod.intern_pool.stringToSlice(decl.name),
5964 fqn,5966 fqn,
5965 di_file,5967 di_file,
5966 line_number,5968 line_number,
5967 try self.dg.object.lowerDebugType(fn_ty, .full),5969 fn_di_ty,
5968 is_internal_linkage,5970 is_internal_linkage,
5969 true, // is definition5971 true, // is definition
5970 line_number + func.lbrace_line, // scope line5972 line_number + func.lbrace_line, // scope line