Improve lb_abi_to_odin_type

This commit is contained in:
gingerBill
2020-11-14 17:09:42 +00:00
parent a64ea342df
commit 9f93042163
2 changed files with 49 additions and 4 deletions
+4
View File
@@ -1278,6 +1278,9 @@ LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
offset = 1;
}
m->internal_type_level += 1;
defer (m->internal_type_level -= 1);
unsigned field_count = cast(unsigned)(type->Struct.fields.count + offset);
LLVMTypeRef *fields = gb_alloc_array(heap_allocator(), LLVMTypeRef, field_count);
GB_ASSERT(fields != nullptr);
@@ -1288,6 +1291,7 @@ LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
fields[i+offset] = lb_type(m, field->type);
}
if (type->Struct.custom_align > 0) {
fields[0] = lb_alignment_prefix_type_hack(m, type->Struct.custom_align);
}