From fa3dcecb7c98bdcd661ba2355fbd64ad2df9c928 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Fri, 27 Feb 2026 10:29:06 +0000 Subject: [PATCH] docs: add documentation for functions in PR #59604 --- src/backend/Assembly.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/Assembly.zig b/src/backend/Assembly.zig index 914bffb..1caa9e5 100644 --- a/src/backend/Assembly.zig +++ b/src/backend/Assembly.zig @@ -6,11 +6,18 @@ text: []const u8, const Assembly = @This(); +/// Frees the memory allocated for the assembly data and text sections. +/// This should be called when the Assembly instance is no longer needed. pub fn deinit(self: *const Assembly, gpa: Allocator) void { gpa.free(self.data); gpa.free(self.text); } +/// Writes the assembly data and text sections to a file using writev for efficiency. +/// This writes both sections sequentially without any separator between them. +/// +/// **Errors:** +/// - Returns any error from `file.writevAll` if the write operation fails. pub fn writeToAllFile(self: Assembly, file: std.fs.File) !void { var vec: [2]std.posix.iovec_const = .{ .{ .base = self.data.ptr, .len = self.data.len }, -- Gitee