Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Struct

Subprogram

Public Struct
std.zig.llvm.Builder.Metadata.Subprogram
pub const Subprogram = struct

Fields

file: Metadata.Optional
name: Metadata.String.Optional
linkage_name: Metadata.String.Optional
line: u32
scope_line: u32
ty: Metadata.Optional
di_flags: DIFlags
compile_unit: Metadata.Optional

Structs

File

zig/llvm/Builder.zig:9382
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
    pub const Subprogram = struct {
        pub const Options = struct {
            di_flags: DIFlags,
            sp_flags: DISPFlags,
        };

        pub const DISPFlags = packed struct(u32) {
            Virtuality: enum(u2) { Zero, Virtual, PureVirtual } = .Zero,
            LocalToUnit: bool = false,
            Definition: bool = false,
            Optimized: bool = false,
            Pure: bool = false,
            Elemental: bool = false,
            Recursive: bool = false,
            MainSubprogram: bool = false,
            Deleted: bool = false,
            ReservedBit10: u1 = 0,
            ObjCDirect: bool = false,
            Unused: u20 = 0,

            pub fn format(self: DISPFlags, w: *Writer) Writer.Error!void {
                var need_pipe = false;
                const info = @typeInfo(DISPFlags).@"struct";
                inline for (info.field_names, info.field_types) |field_name, field_type| {
                    switch (@typeInfo(field_type)) {
                        .bool => if (@field(self, field_name)) {
                            if (need_pipe) try w.writeAll(" | ") else need_pipe = true;
                            try w.print("DISPFlag{s}", .{field_name});
                        },
                        .@"enum" => if (@field(self, field_name) != .Zero) {
                            if (need_pipe) try w.writeAll(" | ") else need_pipe = true;
                            try w.print("DISPFlag{s}", .{@tagName(@field(self, field_name))});
                        },
                        .int => assert(@field(self, field_name) == 0),
                        else => @compileError("bad field type: " ++ field_name ++ ": " ++
                            @typeName(field_type)),
                    }
                }
                if (!need_pipe) try w.writeByte('0');
            }
        };

        file: Metadata.Optional,
        name: Metadata.String.Optional,
        linkage_name: Metadata.String.Optional,
        line: u32,
        scope_line: u32,
        ty: Metadata.Optional,
        di_flags: DIFlags,
        compile_unit: Metadata.Optional,
    }