Improvement to the Odin calling conventions to pass certain things by "implicit reference" (const & in C++)

This commit is contained in:
gingerBill
2019-07-27 10:20:11 +01:00
parent 540730c0be
commit f3bffb9810
3 changed files with 11 additions and 3 deletions
+8
View File
@@ -2084,6 +2084,14 @@ void set_procedure_abi_types(CheckerContext *c, Type *type) {
Type *original_type = e->type;
Type *new_type = type_to_abi_compat_param_type(c->allocator, original_type, type->Proc.calling_convention);
type->Proc.abi_compat_params[i] = new_type;
switch (type->Proc.calling_convention) {
case ProcCC_Odin:
case ProcCC_Contextless:
if (is_type_pointer(new_type) & !is_type_pointer(e->type)) {
e->flags |= EntityFlag_ImplicitReference;
}
break;
}
}
}