Skip to content

Commit 2fb5174

Browse files
aykevldeadprogram
authored andcommitted
compiler: fix basic block context
llvm.AddBasicBlock should never be used. Instead, we should use the AddBasicBlock method of the current LLVM context. This didn't lead to any bugs... yet. But probably would, eventually.
1 parent b31281a commit 2fb5174

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/alias.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (b *builder) createAlias(alias llvm.Value) {
8686
pos := b.program.Fset.Position(b.fn.Pos())
8787
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
8888
}
89-
entryBlock := llvm.AddBasicBlock(b.llvmFn, "entry")
89+
entryBlock := b.ctx.AddBasicBlock(b.llvmFn, "entry")
9090
b.SetInsertPointAtEnd(entryBlock)
9191
if b.llvmFn.Type() != alias.Type() {
9292
b.addError(b.fn.Pos(), "alias function should have the same type as aliasee "+alias.Name())

0 commit comments

Comments
 (0)