| author | |
| committer | |
| log | 46033a2128b09ed15f38f6ed2602bf80989a770f |
| tree | 6a5e2df1c15ac9fd6f48181adb12e150d98d63be |
| parent | 23bebdbcd51ac426f829713ce278b86ccaeb97f4 |
4 files changed, 18 insertions(+), 13 deletions(-)
src/analyze.cpp+4-1| ... | @@ -2234,7 +2234,10 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) { | ... | @@ -2234,7 +2234,10 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 2234 | VariableTableEntry *var = add_variable(g, param_decl_node, fn_table_entry->child_scope, param_decl->name, param_type, true, nullptr); | 2234 | VariableTableEntry *var = add_variable(g, param_decl_node, fn_table_entry->child_scope, param_decl->name, param_type, true, nullptr); |
| 2235 | var->src_arg_index = i; | 2235 | var->src_arg_index = i; |
| 2236 | fn_table_entry->child_scope = var->child_scope; | 2236 | fn_table_entry->child_scope = var->child_scope; |
| 2237 | fn_table_entry->variable_list.append(var); | 2237 | |
| 2238 | if (type_has_bits(param_type)) { | ||
| 2239 | fn_table_entry->variable_list.append(var); | ||
| 2240 | } | ||
| 2238 | 2241 | ||
| 2239 | if (fn_type->data.fn.gen_param_info) { | 2242 | if (fn_type->data.fn.gen_param_info) { |
| 2240 | var->gen_arg_index = fn_type->data.fn.gen_param_info[i].gen_index; | 2243 | var->gen_arg_index = fn_type->data.fn.gen_param_info[i].gen_index; |
src/codegen.cpp+3| ... | @@ -1650,6 +1650,9 @@ static LLVMValueRef ir_render_switch_br(CodeGen *g, IrExecutable *executable, Ir | ... | @@ -1650,6 +1650,9 @@ static LLVMValueRef ir_render_switch_br(CodeGen *g, IrExecutable *executable, Ir |
| 1650 | } | 1650 | } |
| 1651 | 1651 | ||
| 1652 | static LLVMValueRef ir_render_phi(CodeGen *g, IrExecutable *executable, IrInstructionPhi *instruction) { | 1652 | static LLVMValueRef ir_render_phi(CodeGen *g, IrExecutable *executable, IrInstructionPhi *instruction) { |
| 1653 | if (!type_has_bits(instruction->base.type_entry)) | ||
| 1654 | return nullptr; | ||
| 1655 | |||
| 1653 | LLVMTypeRef phi_type; | 1656 | LLVMTypeRef phi_type; |
| 1654 | if (handle_is_ptr(instruction->base.type_entry)) { | 1657 | if (handle_is_ptr(instruction->base.type_entry)) { |
| 1655 | phi_type = LLVMPointerType(instruction->base.type_entry->type_ref, 0); | 1658 | phi_type = LLVMPointerType(instruction->base.type_entry->type_ref, 0); |
test/cases3/fn.zig+11| ... | @@ -19,6 +19,17 @@ fn testLocVars(b: i32) { | ... | @@ -19,6 +19,17 @@ fn testLocVars(b: i32) { |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | fn voidParameters() { | ||
| 23 | @setFnTest(this); | ||
| 24 | |||
| 25 | voidFun(1, void{}, 2, {}); | ||
| 26 | } | ||
| 27 | fn voidFun(a: i32, b: void, c: i32, d: void) { | ||
| 28 | const v = b; | ||
| 29 | const vv: void = if (a == 1) {v} else {}; | ||
| 30 | assert(a + c == 3); | ||
| 31 | return vv; | ||
| 32 | } | ||
| 22 | 33 | ||
| 23 | 34 | ||
| 24 | // TODO const assert = @import("std").debug.assert; | 35 | // TODO const assert = @import("std").debug.assert; |
test/self_hosted.zig-12| ... | @@ -17,18 +17,6 @@ const test_this = @import("cases/this.zig"); | ... | @@ -17,18 +17,6 @@ const test_this = @import("cases/this.zig"); |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | fn voidParameters() { | ||
| 21 | @setFnTest(this); | ||
| 22 | |||
| 23 | voidFun(1, void{}, 2, {}); | ||
| 24 | } | ||
| 25 | fn voidFun(a: i32, b: void, c: i32, d: void) { | ||
| 26 | const v = b; | ||
| 27 | const vv: void = if (a == 1) {v} else {}; | ||
| 28 | assert(a + c == 3); | ||
| 29 | return vv; | ||
| 30 | } | ||
| 31 | |||
| 32 | fn mutableLocalVariables() { | 20 | fn mutableLocalVariables() { |
| 33 | @setFnTest(this, true); | 21 | @setFnTest(this, true); |
| 34 | 22 |