InternPool: fix more key lifetime issues

Reminder to look into deleting `get` and make keys less pointery and
more long lived.
This commit is contained in:
Jacob Young 2023-06-01 19:48:36 -04:00 committed by Andrew Kelley
parent 9b48fc2833
commit 8299ddfe4f
3 changed files with 9 additions and 7 deletions

View File

@ -16452,7 +16452,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const enum_field_vals = try sema.arena.alloc(InternPool.Index, enum_type.names.len);
for (enum_field_vals, 0..) |*field_val, i| {
const name_ip = enum_type.names[i];
const name_ip = mod.intern_pool.indexToKey(ty.toIntern()).enum_type.names[i];
const name = mod.intern_pool.stringToSlice(name_ip);
const name_val = v: {
var anon_decl = try block.startAnonDecl();

View File

@ -2331,14 +2331,15 @@ pub const Object = struct {
try param_di_types.append(try o.lowerDebugType(ptr_ty, .full));
}
for (mod.typeToFunc(ty).?.param_types) |param_ty| {
if (!param_ty.toType().hasRuntimeBitsIgnoreComptime(mod)) continue;
for (0..mod.typeToFunc(ty).?.param_types.len) |i| {
const param_ty = mod.typeToFunc(ty).?.param_types[i].toType();
if (!param_ty.hasRuntimeBitsIgnoreComptime(mod)) continue;
if (isByRef(param_ty.toType(), mod)) {
const ptr_ty = try mod.singleMutPtrType(param_ty.toType());
if (isByRef(param_ty, mod)) {
const ptr_ty = try mod.singleMutPtrType(param_ty);
try param_di_types.append(try o.lowerDebugType(ptr_ty, .full));
} else {
try param_di_types.append(try o.lowerDebugType(param_ty.toType(), .full));
try param_di_types.append(try o.lowerDebugType(param_ty, .full));
}
}

View File

@ -2119,7 +2119,8 @@ pub const Value = struct {
if (try (try val.elemValue(mod, index)).anyUndef(mod)) break true;
} else false,
},
.aggregate => |aggregate| for (aggregate.storage.values()) |elem| {
.aggregate => |aggregate| for (0..aggregate.storage.values().len) |i| {
const elem = mod.intern_pool.indexToKey(val.toIntern()).aggregate.storage.values()[i];
if (try anyUndef(elem.toValue(), mod)) break true;
} else false,
else => false,