| ... | @@ -120,13 +120,13 @@ pub fn generate(file: *C, decl: *Decl) !void { | ... | @@ -120,13 +120,13 @@ pub fn generate(file: *C, decl: *Decl) !void { |
| 120 | try writer.writeAll(");"); | 120 | try writer.writeAll(");"); |
| 121 | }, | 121 | }, |
| 122 | .call => { | 122 | .call => { |
| 123 | const call = inst.cast(ir.Inst.Call).?.args; | 123 | const call = inst.cast(ir.Inst.Call).?; |
| 124 | if (call.func.cast(ir.Inst.Constant)) |func_inst| { | 124 | if (call.args.func.cast(ir.Inst.Constant)) |func_inst| { |
| 125 | if (func_inst.val.cast(Value.Payload.Function)) |func_val| { | 125 | if (func_inst.val.cast(Value.Payload.Function)) |func_val| { |
| 126 | const target = func_val.func.owner_decl; | 126 | const target = func_val.func.owner_decl; |
| 127 | const target_ty = target.typed_value.most_recent.typed_value.ty; | 127 | const target_ty = target.typed_value.most_recent.typed_value.ty; |
| 128 | const ret_ty = target_ty.fnReturnType().tag(); | 128 | const ret_ty = target_ty.fnReturnType().tag(); |
| 129 | if (target_ty.fnReturnType().hasCodeGenBits()) { | 129 | if (target_ty.fnReturnType().hasCodeGenBits() and call.base.isUnused()) { |
| 130 | try writer.print("(void)", .{}); | 130 | try writer.print("(void)", .{}); |
| 131 | } | 131 | } |
| 132 | const tname = mem.spanZ(target.name); | 132 | const tname = mem.spanZ(target.name); |
| ... | @@ -139,7 +139,7 @@ pub fn generate(file: *C, decl: *Decl) !void { | ... | @@ -139,7 +139,7 @@ pub fn generate(file: *C, decl: *Decl) !void { |
| 139 | } else { | 139 | } else { |
| 140 | return file.fail(decl.src(), "TODO non-function call target?", .{}); | 140 | return file.fail(decl.src(), "TODO non-function call target?", .{}); |
| 141 | } | 141 | } |
| 142 | if (call.args.len != 0) { | 142 | if (call.args.args.len != 0) { |
| 143 | return file.fail(decl.src(), "TODO function arguments", .{}); | 143 | return file.fail(decl.src(), "TODO function arguments", .{}); |
| 144 | } | 144 | } |
| 145 | } else { | 145 | } else { |