authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-03-26 21:35:21+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-03-26 21:35:21+00:00
log513254956525f8f970e972f6973ab4df0b19d06a
treeb2163e1439be4858c8e11b7d210ab91e262ab761
parent845226a7c92edc4d6c35727023c63e4cbcf20bbb
signaturelock-open Commit is signed but in an unrecognized format.

Zcu: remove some unused functions


1 files changed, 0 insertions(+), 50 deletions(-)

src/Module.zig-50
......@@ -425,14 +425,6 @@ pub const Decl = struct {
425425 return @as(i32, @bitCast(node_index)) - @as(i32, @bitCast(decl.src_node));
426426 }
427427
428 pub fn tokSrcLoc(decl: Decl, token_index: Ast.TokenIndex) LazySrcLoc {
429 return .{ .token_offset = token_index - decl.srcToken() };
430 }
431
432 pub fn nodeSrcLoc(decl: Decl, node_index: Ast.Node.Index) LazySrcLoc {
433 return LazySrcLoc.nodeOffset(decl.nodeIndexToRelative(node_index));
434 }
435
436428 pub fn srcLoc(decl: Decl, zcu: *Zcu) SrcLoc {
437429 return decl.nodeOffsetSrcLoc(0, zcu);
438430 }
......@@ -445,16 +437,6 @@ pub const Decl = struct {
445437 };
446438 }
447439
448 pub fn srcToken(decl: Decl, zcu: *Zcu) Ast.TokenIndex {
449 const tree = &decl.getFileScope(zcu).tree;
450 return tree.firstToken(decl.src_node);
451 }
452
453 pub fn srcByteOffset(decl: Decl, zcu: *Zcu) u32 {
454 const tree = &decl.getFileScope(zcu).tree;
455 return tree.tokens.items(.start)[decl.srcToken()];
456 }
457
458440 pub fn renderFullyQualifiedName(decl: Decl, zcu: *Zcu, writer: anytype) !void {
459441 if (decl.name_fully_qualified) {
460442 try writer.print("{}", .{decl.name.fmt(&zcu.intern_pool)});
......@@ -486,22 +468,6 @@ pub const Decl = struct {
486468 return decl.val;
487469 }
488470
489 /// If the Decl owns its value and it is a struct, return it,
490 /// otherwise null.
491 pub fn getOwnedStruct(decl: Decl, zcu: *Zcu) ?InternPool.Key.StructType {
492 if (!decl.owns_tv) return null;
493 if (decl.val.ip_index == .none) return null;
494 return zcu.typeToStruct(decl.val.toType());
495 }
496
497 /// If the Decl owns its value and it is a union, return it,
498 /// otherwise null.
499 pub fn getOwnedUnion(decl: Decl, zcu: *Zcu) ?InternPool.LoadedUnionType {
500 if (!decl.owns_tv) return null;
501 if (decl.val.ip_index == .none) return null;
502 return zcu.typeToUnion(decl.val.toType());
503 }
504
505471 pub fn getOwnedFunction(decl: Decl, zcu: *Zcu) ?InternPool.Key.Func {
506472 const i = decl.getOwnedFunctionIndex();
507473 if (i == .none) return null;
......@@ -4427,22 +4393,6 @@ fn scanDecl(iter: *ScanDeclIter, decl_inst: Zir.Inst.Index) Allocator.Error!void
44274393 }
44284394}
44294395
4430/// This function is exclusively called for anonymous decls.
4431/// All resources referenced by anonymous decls are owned by InternPool
4432/// so there is no cleanup to do here.
4433pub fn deleteUnusedDecl(mod: *Module, decl_index: Decl.Index) void {
4434 const gpa = mod.gpa;
4435 const ip = &mod.intern_pool;
4436
4437 ip.destroyDecl(gpa, decl_index);
4438
4439 if (mod.emit_h) |mod_emit_h| {
4440 const decl_emit_h = mod_emit_h.declPtr(decl_index);
4441 decl_emit_h.fwd_decl.deinit(gpa);
4442 decl_emit_h.* = undefined;
4443 }
4444}
4445
44464396/// Cancel the creation of an anon decl and delete any references to it.
44474397/// If other decls depend on this decl, they must be aborted first.
44484398pub fn abortAnonDecl(mod: *Module, decl_index: Decl.Index) void {