Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

todo

x86_64.todo
pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error

File

Code

pub fn todo(c: *AsmCodeGen, msg: []const u8, tok: Tree.TokenIndex) Error {
    const loc: Source.Location = c.tree.tokens.items(.loc)[tok];

    var bfa_buf: [u8]1024 = undefined;
    var bfa: std.heap.BufferFirstAllocator = .init(&bfa_buf, c.comp.gpa);
    const allocator = bfa.allocator();
    var buf: std.ArrayList(u8) = .empty;
    defer buf.deinit(allocator);

    try buf.print(allocator, "TODO: {s}", .{msg});
    try c.comp.diagnostics.add(.{
        .text = buf.items,
        .kind = .@"error",
        .location = loc.expand(c.comp),
    });
    return error.FatalError;
}