diff options
| author | gingerBill <bill@gingerbill.org> | 2023-06-07 00:35:11 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-06-07 00:35:11 +0100 |
| commit | 204924927a6c7d1507323b464de10e0a09dd2163 (patch) | |
| tree | 5761ea169313e6cd1043b8d392ba76dbe2de6426 /src/llvm_abi.cpp | |
| parent | f622a8393cd3e288cefe2f5636b0aa1ab58fe0ca (diff) | |
Ignore non-variable parameters
Diffstat (limited to 'src/llvm_abi.cpp')
| -rw-r--r-- | src/llvm_abi.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 071f34627..877560d91 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -1335,14 +1335,17 @@ namespace lbAbiWasm { auto args = array_make<lbArgType>(lb_function_type_args_allocator(), arg_count); GB_ASSERT(original_type->kind == Type_Proc); - GB_ASSERT(cast(isize)arg_count == original_type->Proc.param_count); + GB_ASSERT(cast(isize)arg_count <= original_type->Proc.param_count); auto const ¶ms = original_type->Proc.params->Tuple.variables; - for (unsigned i = 0; i < arg_count; i++) { + for (unsigned i = 0, j = 0; i < arg_count; i++, j++) { + while (params[j]->kind != Entity_Variable) { + j++; + } + Type *ptype = params[j]->type; LLVMTypeRef t = arg_types[i]; LLVMTypeKind kind = LLVMGetTypeKind(t); if (kind == LLVMStructTypeKind || kind == LLVMArrayTypeKind) { - Type *ptype = params[i]->type; if (is_type_slice(ptype) || is_type_string(ptype)) { args[i] = pseudo_slice(c, t, calling_convention); } else { |