From f99c600ad806ca146ddc20e25e1731c237f0e52b Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 20 May 2021 20:23:10 +0200 Subject: [PATCH] transform: work around renamed return type after merging LLVM modules This fix is very similar to https://github.com/tinygo-org/tinygo/pull/1768, but now for the return type. It fixes the issue in https://github.com/tinygo-org/tinygo/issues/1887. Like #1768, I'm not sure how to test this as it is very specific to certain renames that LLVM does and that don't seem very reproducable. --- transform/interface-lowering.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transform/interface-lowering.go b/transform/interface-lowering.go index e17979da..af3aa8c2 100644 --- a/transform/interface-lowering.go +++ b/transform/interface-lowering.go @@ -532,7 +532,7 @@ func (p *lowerInterfacesPass) getInterfaceMethodFunc(itf *interfaceInfo, signatu paramTypes = append(paramTypes, param.Type()) } calledFunctionType := function.Type() - sig := llvm.PointerType(llvm.FunctionType(calledFunctionType.ElementType().ReturnType(), paramTypes, false), calledFunctionType.PointerAddressSpace()) + sig := llvm.PointerType(llvm.FunctionType(returnType, paramTypes, false), calledFunctionType.PointerAddressSpace()) if sig != function.Type() { function = p.builder.CreateBitCast(function, sig, "") }