diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-15 18:08:52 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-15 18:08:52 +0000 |
| commit | 3c1c10a1785a97831a69fb6d94356d5cc4989bd6 (patch) | |
| tree | 1986555b3eafc3e849400ce423f6cd6ecc08c45d /src/llvm_abi.cpp | |
| parent | 9f930421632f4f6d5352ec01f12a1a7fb1050ba7 (diff) | |
Begin clarifying allocation patterns by changing from `heap_allocator` to specific arenas
Diffstat (limited to 'src/llvm_abi.cpp')
| -rw-r--r-- | src/llvm_abi.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 79f7948a3..f0422e0f8 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -276,6 +276,9 @@ Type *alloc_type_struct_from_field_types(Type **field_types, isize field_count, } Type *alloc_type_tuple_from_field_types(Type **field_types, isize field_count, bool is_packed, bool must_be_tuple) { + if (field_count == 0) { + return nullptr; + } if (!must_be_tuple && field_count == 1) { return field_types[0]; } @@ -297,7 +300,9 @@ Type *alloc_type_proc_from_types(Type **param_types, unsigned param_count, Type Type *params = alloc_type_tuple_from_field_types(param_types, param_count, false, true); isize results_count = 0; if (results != nullptr) { - GB_ASSERT(results->kind == Type_Tuple); + if (results->kind != Type_Tuple) { + results = alloc_type_tuple_from_field_types(&results, 1, false, true); + } results_count = results->Tuple.variables.count; } |