enum Index [src]
Fields
none = std.math.maxInt(u32)
_
Members
- getAlignment (Function)
- name (Function)
- ptr (Function)
- ptrConst (Function)
- rename (Function)
- setAlignment (Function)
- setDllStorageClass (Function)
- setGlobalVariableExpression (Function)
- setInitializer (Function)
- setLinkage (Function)
- setMutability (Function)
- setSection (Function)
- setThreadLocal (Function)
- setUnnamedAddr (Function)
- toConst (Function)
- toValue (Function)
- typeOf (Function)
Source
pub const Index = enum(u32) {
none = std.math.maxInt(u32),
_,
pub fn ptr(self: Index, builder: *Builder) *Variable {
return &builder.variables.items[@intFromEnum(self)];
}
pub fn ptrConst(self: Index, builder: *const Builder) *const Variable {
return &builder.variables.items[@intFromEnum(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 setLinkage(self: Index, linkage: Linkage, builder: *Builder) void {
return self.ptrConst(builder).global.setLinkage(linkage, builder);
}
pub fn setDllStorageClass(self: Index, class: DllStorageClass, builder: *Builder) void {
return self.ptrConst(builder).global.setDllStorageClass(class, builder);
}
pub fn setUnnamedAddr(self: Index, unnamed_addr: UnnamedAddr, builder: *Builder) void {
return self.ptrConst(builder).global.setUnnamedAddr(unnamed_addr, builder);
}
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);
}
}