From b8fe9f7970f82d43114d8aacb485b8cb4fd16c15 Mon Sep 17 00:00:00 2001 From: David Chase Date: Thu, 3 Oct 2019 13:44:33 -0400 Subject: [PATCH] cmd/compile: adjust line numbering for type switch Two changes, one to cause the back end to not number ITab operations (these tend to disappear and are also followed by something more robust) and to explicitly unmark (as statements) all but the first bit of the code generated to implement a type switch. Change-Id: I9f7bf7cbf7ccc5d7eda57f7fb080e600eb312eb0 Reviewed-on: https://go-review.googlesource.com/c/go/+/198739 Run-TryBot: David Chase TryBot-Result: Gobot Gobot Reviewed-by: Jeremy Faller --- src/cmd/compile/internal/gc/swt.go | 1 + src/cmd/compile/internal/ssa/numberlines.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go index 1381cdacba..2098228d75 100644 --- a/src/cmd/compile/internal/gc/swt.go +++ b/src/cmd/compile/internal/gc/swt.go @@ -513,6 +513,7 @@ func walkTypeSwitch(sw *Node) { // Use a similar strategy for non-empty interfaces. ifNil := nod(OIF, nil, nil) ifNil.Left = nod(OEQ, itab, nodnil()) + lineno = lineno.WithNotStmt() // disable statement marks after the first check. ifNil.Left = typecheck(ifNil.Left, ctxExpr) ifNil.Left = defaultlit(ifNil.Left, nil) // ifNil.Nbody assigned at end. diff --git a/src/cmd/compile/internal/ssa/numberlines.go b/src/cmd/compile/internal/ssa/numberlines.go index 68195e9b65..6321d61537 100644 --- a/src/cmd/compile/internal/ssa/numberlines.go +++ b/src/cmd/compile/internal/ssa/numberlines.go @@ -15,7 +15,7 @@ func isPoorStatementOp(op Op) bool { switch op { // Note that Nilcheck often vanishes, but when it doesn't, you'd love to start the statement there // so that a debugger-user sees the stop before the panic, and can examine the value. - case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, + case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, OpITab, OpIData, OpIMake, OpStringMake, OpSliceMake, OpStructMake0, OpStructMake1, OpStructMake2, OpStructMake3, OpStructMake4, OpConstBool, OpConst8, OpConst16, OpConst32, OpConst64, OpConst32F, OpConst64F: return true -- 2.50.0