stage2: handle void value in genRet in LLVM backend

This commit is contained in:
Timon Kruiper 2021-03-23 16:06:15 +01:00 committed by Andrew Kelley
parent d73b0473a1
commit 982df37135

View File

@ -727,6 +727,11 @@ pub const FuncGen = struct {
}
fn genRet(self: *FuncGen, inst: *Inst.UnOp) !?*const llvm.Value {
if (!inst.operand.ty.hasCodeGenBits()) {
// TODO: in astgen these instructions should turn into `retvoid` instructions.
_ = self.builder.buildRetVoid();
return null;
}
_ = self.builder.buildRet(try self.resolveInst(inst.operand));
return null;
}