diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-03-26 21:35:21 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-03-26 21:35:21 +0000 |
| commit | 513254956525f8f970e972f6973ab4df0b19d06a (patch) | |
| tree | b2163e1439be4858c8e11b7d210ab91e262ab761 /src/Module.zig | |
| parent | 845226a7c92edc4d6c35727023c63e4cbcf20bbb (diff) | |
| download | zig-513254956525f8f970e972f6973ab4df0b19d06a.tar.gz zig-513254956525f8f970e972f6973ab4df0b19d06a.zip | |
Zcu: remove some unused functions
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/Module.zig b/src/Module.zig index df39a2a869..d4a4522441 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -425,14 +425,6 @@ pub const Decl = struct { return @as(i32, @bitCast(node_index)) - @as(i32, @bitCast(decl.src_node)); } - pub fn tokSrcLoc(decl: Decl, token_index: Ast.TokenIndex) LazySrcLoc { - return .{ .token_offset = token_index - decl.srcToken() }; - } - - pub fn nodeSrcLoc(decl: Decl, node_index: Ast.Node.Index) LazySrcLoc { - return LazySrcLoc.nodeOffset(decl.nodeIndexToRelative(node_index)); - } - pub fn srcLoc(decl: Decl, zcu: *Zcu) SrcLoc { return decl.nodeOffsetSrcLoc(0, zcu); } @@ -445,16 +437,6 @@ pub const Decl = struct { }; } - pub fn srcToken(decl: Decl, zcu: *Zcu) Ast.TokenIndex { - const tree = &decl.getFileScope(zcu).tree; - return tree.firstToken(decl.src_node); - } - - pub fn srcByteOffset(decl: Decl, zcu: *Zcu) u32 { - const tree = &decl.getFileScope(zcu).tree; - return tree.tokens.items(.start)[decl.srcToken()]; - } - pub fn renderFullyQualifiedName(decl: Decl, zcu: *Zcu, writer: anytype) !void { if (decl.name_fully_qualified) { try writer.print("{}", .{decl.name.fmt(&zcu.intern_pool)}); @@ -486,22 +468,6 @@ pub const Decl = struct { return decl.val; } - /// If the Decl owns its value and it is a struct, return it, - /// otherwise null. - pub fn getOwnedStruct(decl: Decl, zcu: *Zcu) ?InternPool.Key.StructType { - if (!decl.owns_tv) return null; - if (decl.val.ip_index == .none) return null; - return zcu.typeToStruct(decl.val.toType()); - } - - /// If the Decl owns its value and it is a union, return it, - /// otherwise null. - pub fn getOwnedUnion(decl: Decl, zcu: *Zcu) ?InternPool.LoadedUnionType { - if (!decl.owns_tv) return null; - if (decl.val.ip_index == .none) return null; - return zcu.typeToUnion(decl.val.toType()); - } - pub fn getOwnedFunction(decl: Decl, zcu: *Zcu) ?InternPool.Key.Func { const i = decl.getOwnedFunctionIndex(); if (i == .none) return null; @@ -4427,22 +4393,6 @@ fn scanDecl(iter: *ScanDeclIter, decl_inst: Zir.Inst.Index) Allocator.Error!void } } -/// This function is exclusively called for anonymous decls. -/// All resources referenced by anonymous decls are owned by InternPool -/// so there is no cleanup to do here. -pub fn deleteUnusedDecl(mod: *Module, decl_index: Decl.Index) void { - const gpa = mod.gpa; - const ip = &mod.intern_pool; - - ip.destroyDecl(gpa, decl_index); - - if (mod.emit_h) |mod_emit_h| { - const decl_emit_h = mod_emit_h.declPtr(decl_index); - decl_emit_h.fwd_decl.deinit(gpa); - decl_emit_h.* = undefined; - } -} - /// Cancel the creation of an anon decl and delete any references to it. /// If other decls depend on this decl, they must be aborted first. pub fn abortAnonDecl(mod: *Module, decl_index: Decl.Index) void { |
