Helps keep line numbers around for debugging, particularly
for break and continue statements (which often compile
down to nothing).
Update #14379
Change-Id: I6ea06aa887b0450d9ba4f11e319e5c263f5a98ba
Reviewed-on: https://go-review.googlesource.com/19848
Reviewed-by: David Chase <drchase@google.com>
}
// Emit control flow instructions for block
var next *ssa.Block
- if i < len(f.Blocks)-1 {
+ if i < len(f.Blocks)-1 && Debug['N'] == 0 {
+ // If -N, leave next==nil so every block with successors
+ // ends in a JMP. Helps keep line numbers for otherwise
+ // empty blocks.
next = f.Blocks[i+1]
}
x := Pc
// allocate a new block to place on the edge
d := f.NewBlock(BlockPlain)
+ d.Line = c.Line
// splice it in
d.Preds = append(d.Preds, c)