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 Enum

Index

Public Enum
std.zig.llvm.Builder.Variable.Index
pub const Index = enum(u32)

Functions

pub fn ptr(self: Index, builder: *Builder) *Variable
pub fn ptrConst(self: Index, builder: *const Builder) *const Variable
pub fn name(self: Index, builder: *const Builder) StrtabString
pub fn rename(self: Index, new_name: StrtabString, builder: *Builder) Allocator.Error!void
pub fn typeOf(self: Index, builder: *const Builder) Type
pub fn toConst(self: Index, builder: *const Builder) Constant
pub fn toValue(self: Index, builder: *const Builder) Value
pub fn setThreadLocal(self: Index, thread_local: ThreadLocal, builder: *Builder) void
pub fn setMutability(self: Index, mutability: Mutability, builder: *Builder) void
pub fn setInitializer(self: Index, initializer: Constant, builder: *Builder) Allocator.Error!void
pub fn setSection(self: Index, section: String, builder: *Builder) void
pub fn setAlignment(self: Index, alignment: Alignment, builder: *Builder) void
pub fn getAlignment(self: Index, builder: *Builder) Alignment
pub fn setGlobalVariableExpression(self: Index, expression: Metadata, builder: *Builder) void
pub fn getGlobalVariableExpression(self: Index, builder: *Builder) Metadata.Optional

File

zig/llvm/Builder.zig:3543
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
    pub const Index = enum(u32) {
        none = maxInt(u32),
        _,

        pub fn ptr(self: Index, builder: *Builder) *Variable {
            return &builder.variables.items[@backingInt(self)];
        }

        pub fn ptrConst(self: Index, builder: *const Builder) *const Variable {
            return &builder.variables.items[@backingInt(self)];
        }

        pub fn name(self: Index, builder: *const Builder) StrtabString {
            return self.ptrConst(builder).global.name(builder);
        }

        pub fn rename(self: Index, new_name: StrtabString, builder: *Builder) Allocator.Error!void {
            return self.ptrConst(builder).global.rename(new_name, builder);
        }

        pub fn typeOf(self: Index, builder: *const Builder) Type {
            return self.ptrConst(builder).global.typeOf(builder);
        }

        pub fn toConst(self: Index, builder: *const Builder) Constant {
            return self.ptrConst(builder).global.toConst();
        }

        pub fn toValue(self: Index, builder: *const Builder) Value {
            return self.toConst(builder).toValue();
        }

        pub fn setThreadLocal(self: Index, thread_local: ThreadLocal, builder: *Builder) void {
            self.ptr(builder).thread_local = thread_local;
        }

        pub fn setMutability(self: Index, mutability: Mutability, builder: *Builder) void {
            self.ptr(builder).mutability = mutability;
        }

        pub fn setInitializer(
            self: Index,
            initializer: Constant,
            builder: *Builder,
        ) Allocator.Error!void {
            if (initializer != .no_init) {
                const variable = self.ptrConst(builder);
                const global = variable.global.ptr(builder);
                const initializer_type = initializer.typeOf(builder);
                global.type = initializer_type;
            }
            self.ptr(builder).init = initializer;
        }

        pub fn setSection(self: Index, section: String, builder: *Builder) void {
            self.ptr(builder).section = section;
        }

        pub fn setAlignment(self: Index, alignment: Alignment, builder: *Builder) void {
            self.ptr(builder).alignment = alignment;
        }

        pub fn getAlignment(self: Index, builder: *Builder) Alignment {
            return self.ptr(builder).alignment;
        }

        pub fn setGlobalVariableExpression(self: Index, expression: Metadata, builder: *Builder) void {
            self.ptrConst(builder).global.setDebugMetadata(expression, builder);
        }

        pub fn getGlobalVariableExpression(self: Index, builder: *Builder) Metadata.Optional {
            return self.ptrConst(builder).global.getDebugMetadata(builder);
        }
    }