From f3bffb98101e3a584c8a5e8a6389c608ffe64c40 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 27 Jul 2019 10:20:11 +0100 Subject: Improvement to the Odin calling conventions to pass certain things by "implicit reference" (`const &` in C++) --- src/check_type.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index f4e5b49d0..5b20a48fc 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -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; + } } } -- cgit v1.2.3