mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 06:23:39 +00:00
compiler: simplify code around getZeroValue
The LLVM library we use does not (yet) provide a llvm.Zero (like it provides a llvm.Undef) so we have implemented our own. However, in theory it might return an error in some cases. No real-world errors have been seen in a while and errors would likely indicate a serious compiler bug anyway (not an external error), so make it panic instead of returning an error.
This commit is contained in:
committed by
Ron Evans
parent
024eceb476
commit
6d23809218
+1
-4
@@ -136,10 +136,7 @@ func (c *Compiler) emitDefer(frame *Frame, instr *ssa.Defer) error {
|
||||
|
||||
// Make a struct out of the collected values to put in the defer frame.
|
||||
deferFrameType := c.ctx.StructType(valueTypes, false)
|
||||
deferFrame, err := c.getZeroValue(deferFrameType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
deferFrame := c.getZeroValue(deferFrameType)
|
||||
for i, value := range values {
|
||||
deferFrame = c.builder.CreateInsertValue(deferFrame, value, i, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user