llvmlite
llvmlite copied to clipboard
Publicly expose (document) the type attribute of Constants
ir.Constant
objects are constructed with an ir.Type
argument, which is stored in the undocumented self.type
attribute. That attribute is helpful for using ir.Constant
s in places where an explicit type is needed, such as alloca
:
constant = get_some_constant()
slot = builder.alloca(constant.type)
builder.store(constant, slot)
But I don't feel good about using it unless it's clearly documented as part of the public API.