Skip to content

Commit 2f27cf5

Browse files
committed
Feature(compiler): Add ret void when function body is empty and type is void
1 parent 1847d80 commit 2f27cf5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/backend/llvm/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ export function passFunctionDeclaration(parent: ts.FunctionDeclaration, ctx: Con
173173
passStatement(stmt, ctx, irBuilder);
174174
}
175175
}
176+
177+
if (!block.getTerminator() && returnType.isVoidTy()) {
178+
irBuilder.createRetVoid();
179+
}
176180
}
177181

178182
export function buildFromStringValue(node: ts.StringLiteral, ctx: Context, builder: llvm.IRBuilder): llvm.Value {

0 commit comments

Comments
 (0)