structstd.zig.llvm.Builder.Metadata.DIFlags[src]

Fields

Visibility: enum(u2) { Zero, Private, Protected, Public } = .Zero
FwdDecl: bool = false
AppleBlock: bool = false
ReservedBit4: u1 = 0
Virtual: bool = false
Artificial: bool = false
Explicit: bool = false
Prototyped: bool = false
ObjcClassComplete: bool = false
ObjectPointer: bool = false
Vector: bool = false
StaticMember: bool = false
LValueReference: bool = false
RValueReference: bool = false
ExportSymbols: bool = false
Inheritance: enum(u2) {
    Zero,
    SingleInheritance,
    MultipleInheritance,
    VirtualInheritance,
} = .Zero
IntroducedVirtual: bool = false
BitField: bool = false
NoReturn: bool = false
ReservedBit21: u1 = 0
TypePassbyValue: bool = false
TypePassbyReference: bool = false
EnumClass: bool = false
Thunk: bool = false
NonTrivial: bool = false
BigEndian: bool = false
LittleEndian: bool = false
AllCallsDescribed: bool = false
Unused: u2 = 0

Functions

Functionformat[src]

pub fn format( self: DIFlags, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void

Parameters

self: DIFlags
_: []const u8

Source Code

Source code
pub fn format(
    self: DIFlags,
    comptime _: []const u8,
    _: std.fmt.FormatOptions,
    writer: anytype,
) @TypeOf(writer).Error!void {
    var need_pipe = false;
    inline for (@typeInfo(DIFlags).@"struct".fields) |field| {
        switch (@typeInfo(field.type)) {
            .bool => if (@field(self, field.name)) {
                if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
                try writer.print("DIFlag{s}", .{field.name});
            },
            .@"enum" => if (@field(self, field.name) != .Zero) {
                if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
                try writer.print("DIFlag{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 writer.writeByte('0');
}

Source Code

Source code
pub const DIFlags = packed struct(u32) {
    Visibility: enum(u2) { Zero, Private, Protected, Public } = .Zero,
    FwdDecl: bool = false,
    AppleBlock: bool = false,
    ReservedBit4: u1 = 0,
    Virtual: bool = false,
    Artificial: bool = false,
    Explicit: bool = false,
    Prototyped: bool = false,
    ObjcClassComplete: bool = false,
    ObjectPointer: bool = false,
    Vector: bool = false,
    StaticMember: bool = false,
    LValueReference: bool = false,
    RValueReference: bool = false,
    ExportSymbols: bool = false,
    Inheritance: enum(u2) {
        Zero,
        SingleInheritance,
        MultipleInheritance,
        VirtualInheritance,
    } = .Zero,
    IntroducedVirtual: bool = false,
    BitField: bool = false,
    NoReturn: bool = false,
    ReservedBit21: u1 = 0,
    TypePassbyValue: bool = false,
    TypePassbyReference: bool = false,
    EnumClass: bool = false,
    Thunk: bool = false,
    NonTrivial: bool = false,
    BigEndian: bool = false,
    LittleEndian: bool = false,
    AllCallsDescribed: bool = false,
    Unused: u2 = 0,

    pub fn format(
        self: DIFlags,
        comptime _: []const u8,
        _: std.fmt.FormatOptions,
        writer: anytype,
    ) @TypeOf(writer).Error!void {
        var need_pipe = false;
        inline for (@typeInfo(DIFlags).@"struct".fields) |field| {
            switch (@typeInfo(field.type)) {
                .bool => if (@field(self, field.name)) {
                    if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
                    try writer.print("DIFlag{s}", .{field.name});
                },
                .@"enum" => if (@field(self, field.name) != .Zero) {
                    if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
                    try writer.print("DIFlag{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 writer.writeByte('0');
    }
}