mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-22 09:53:23 +00:00
Merge branch 'master' into windows-llvm-11.1.0
This commit is contained in:
@@ -672,7 +672,7 @@ shrink_dynamic_array :: proc(array: ^$T/[dynamic]$E, new_cap := -1, loc := #call
|
||||
@builtin
|
||||
map_insert :: proc(m: ^$T/map[$K]$V, key: K, value: V, loc := #caller_location) -> (ptr: ^V) {
|
||||
key, value := key, value
|
||||
h := __get_map_header(T)
|
||||
h := __get_map_header_table(T)
|
||||
|
||||
e := __dynamic_map_set(m, h, __get_map_key_hash(&key), &key, &value, loc)
|
||||
return (^V)(uintptr(e) + h.value_offset)
|
||||
|
||||
@@ -4751,6 +4751,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
|
||||
new_type->Union.variants = variants;
|
||||
|
||||
// NOTE(bill): Is this even correct?
|
||||
new_type->Union.node = operand->expr;
|
||||
new_type->Union.scope = bt->Union.scope;
|
||||
|
||||
operand->type = new_type;
|
||||
|
||||
@@ -639,7 +639,7 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
|
||||
doc_type.polmorphic_params = odin_doc_type(w, type->Union.polymorphic_params);
|
||||
}
|
||||
|
||||
if (type->Union.node) {
|
||||
if (type->Union.node && type->Union.node->kind == Ast_UnionType) {
|
||||
ast_node(ut, UnionType, type->Union.node);
|
||||
if (ut->align) {
|
||||
doc_type.custom_align = odin_doc_expr_string(w, ut->align);
|
||||
|
||||
@@ -1507,6 +1507,7 @@ LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *type) {
|
||||
|
||||
LLVMTypeRef ret = nullptr;
|
||||
LLVMTypeRef *params = gb_alloc_array(permanent_allocator(), LLVMTypeRef, param_count);
|
||||
bool *params_by_ptr = gb_alloc_array(permanent_allocator(), bool, param_count);
|
||||
if (type->Proc.result_count != 0) {
|
||||
Type *single_ret = reduce_tuple_to_single_type(type->Proc.results);
|
||||
ret = lb_type(m, single_ret);
|
||||
@@ -1532,9 +1533,12 @@ LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *type) {
|
||||
}
|
||||
Type *e_type = reduce_tuple_to_single_type(e->type);
|
||||
|
||||
bool param_is_by_ptr = false;
|
||||
LLVMTypeRef param_type = nullptr;
|
||||
if (e->flags & EntityFlag_ByPtr) {
|
||||
param_type = lb_type(m, alloc_type_pointer(e_type));
|
||||
// it will become a pointer afterwards by making it indirect
|
||||
param_type = lb_type(m, e_type);
|
||||
param_is_by_ptr = true;
|
||||
} else if (is_type_boolean(e_type) &&
|
||||
type_size_of(e_type) <= 1) {
|
||||
param_type = LLVMInt1TypeInContext(m->ctx);
|
||||
@@ -1546,6 +1550,7 @@ LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *type) {
|
||||
}
|
||||
}
|
||||
|
||||
params_by_ptr[param_index] = param_is_by_ptr;
|
||||
params[param_index++] = param_type;
|
||||
}
|
||||
}
|
||||
@@ -1571,6 +1576,12 @@ LLVMTypeRef lb_type_internal_for_procedures_raw(lbModule *m, Type *type) {
|
||||
LLVMPrintTypeToString(ft->ret.type),
|
||||
LLVMGetTypeContext(ft->ret.type), ft->ctx, LLVMGetGlobalContext());
|
||||
}
|
||||
for_array(j, ft->args) {
|
||||
if (params_by_ptr[j]) {
|
||||
// NOTE(bill): The parameter needs to be passed "indirectly", override it
|
||||
ft->args[j].kind = lbArg_Indirect;
|
||||
}
|
||||
}
|
||||
|
||||
map_set(&m->function_type_map, type, ft);
|
||||
LLVMTypeRef new_abi_fn_type = lb_function_type_to_llvm_raw(ft, type->Proc.c_vararg);
|
||||
|
||||
Reference in New Issue
Block a user