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.

genDecls

x86_64.genDecls
fn genDecls(c: *AsmCodeGen) !void

File

Code

fn genDecls(c: *AsmCodeGen) !void {
    if (c.tree.comp.code_gen_options.debug != .strip) {
        const sources = c.tree.comp.sources.values();
        for (sources) |source| {
            try c.data.print("  .file {d} \"{s}\"\n", .{ @backingInt(source.id.index) + 1, source.path });
        }
    }

    for (c.tree.root_decls.items) |decl| {
        switch (decl.get(c.tree)) {
            .static_assert,
            .typedef,
            .struct_decl,
            .union_decl,
            .enum_decl,
            => {},

            .function => |function| {
                if (function.body == null) continue;
                try c.genFn(function);
            },

            .variable => |variable| try c.genVar(variable),

            else => unreachable,
        }
    }
    try c.text.writeAll("  .section  .note.GNU-stack,\"\",@progbits\n");
}