llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

Publicly expose (document) the type attribute of Constants

Open SyntaxColoring opened this issue 5 years ago • 0 comments

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.Constants 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.

SyntaxColoring avatar May 31 '19 01:05 SyntaxColoring