To generate a function, tinygo builds a function using llvm and a list of pre-defined basic blocks. Therefore it needs the first basic block for the entry point of a function. If the list of BasicBlocks is empty, this indicates that the function is external 1.
Getting the first basic block is then impossible and results in a panic (observed in 2).
This PR aims to fix this issue and end the compilation gracefully. Since my experience with compiler development is non though, it would be great if the original authors (@aykevl) could take care of the logic behind this and probably make it behave sanely.
To generate a function, tinygo builds a function using llvm and a list of pre-defined basic blocks. Therefore it needs the first basic block for the entry point of a function. If the list of
BasicBlock
s is empty, this indicates that the function is external 1. Getting the first basic block is then impossible and results in a panic (observed in 2).This PR aims to fix this issue and end the compilation gracefully. Since my experience with compiler development is non though, it would be great if the original authors (@aykevl) could take care of the logic behind this and probably make it behave sanely.