Not setting the correct debug location at function entry leads to
instructions getting the address of the previously emitted function,
which is of course wrong. LLVM complains about it when validating a
module.
Этот коммит содержится в:
Ayke van Laethem 2018-09-05 16:41:34 +02:00
родитель 9101ea11bf
коммит 87dd1a1fe5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -1103,6 +1103,11 @@ func (c *Compiler) parseFunc(frame *Frame) error {
frame.fn.llvmFn.SetLinkage(llvm.InternalLinkage)
}
if c.debug {
pos := c.ir.program.Fset.Position(frame.fn.fn.Pos())
c.builder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), frame.difunc, llvm.Metadata{})
}
// Pre-create all basic blocks in the function.
for _, block := range frame.fn.fn.DomPreorder() {
llvmBlock := c.ctx.AddBasicBlock(frame.fn.llvmFn, block.Comment)