From cdb8d54b6808b13092cb85e44cf02e4e91c3a669 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 11 Mar 2010 14:48:51 -0800 Subject: [PATCH] Default function parameters to 'in' instead of auto --- ast_to_hir.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 1fea7299dbd..c791aec3e24 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1007,7 +1007,12 @@ ast_parameter_declarator::hir(exec_list *instructions, * FINISHME: complete handling of constant expressions. */ + /* Apply any specified qualifiers to the parameter declaration. Note that + * for function parameters the default mode is 'in'. + */ apply_type_qualifier_to_variable(& this->type->qualifier, var, state); + if (var->mode == ir_var_auto) + var->mode = ir_var_in; instructions->push_tail(var); @@ -1155,7 +1160,7 @@ ast_function_definition::hir(exec_list *instructions, foreach_iter(exec_list_iterator, iter, parameters) { ir_variable *const var = (ir_variable *) iter.get(); - assert(var->mode == ir_op_var_decl); + assert(((ir_instruction *)var)->mode == ir_op_var_decl); iter.remove(); instructions->push_tail(var); -- 2.30.2