Skip to content

Commit

Permalink
compiler: fix basic block context
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aykevl committed Nov 29, 2021
1 parent 47db50b commit 2561ae3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (b *builder) createAlias(alias llvm.Value) {
pos := b.program.Fset.Position(b.fn.Pos())
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
}
entryBlock := llvm.AddBasicBlock(b.llvmFn, "entry")
entryBlock := b.ctx.AddBasicBlock(b.llvmFn, "entry")
b.SetInsertPointAtEnd(entryBlock)
if b.llvmFn.Type() != alias.Type() {
b.addError(b.fn.Pos(), "alias function should have the same type as aliasee "+alias.Name())
Expand Down

0 comments on commit 2561ae3

Please sign in to comment.