reserve tag union as array of bytes in llvm

This commit is contained in:
Folkert 2020-03-17 00:13:47 +01:00
parent 6ff22de9dd
commit 444e3063e0

View file

@ -68,8 +68,15 @@ pub fn basic_type_from_layout<'ctx>(
.struct_type(field_types.into_bump_slice(), false)
.as_basic_type_enum()
}
Union(_fields) => {
panic!("TODO layout_to_basic_type for Tag");
Union(fields) => {
// TODO make this dynamic
let ptr_size = std::mem::size_of::<i64>();
let union_size = layout.stack_size(ptr_size as u32);
context
.i8_type()
.array_type(union_size)
.as_basic_type_enum()
}
Pointer(_layout) => {
panic!("TODO layout_to_basic_type for Pointer");