summaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/coverage/cover.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2023-02-28 13:27:51 -0800
committerGopher Robot <gobot@golang.org>2023-03-04 00:00:01 +0000
commitb94dc384cabf75e7e8703265cd80f5324f84b642 (patch)
tree716768a54c0028c240fe89443286a2bf30fa2968 /src/cmd/compile/internal/coverage/cover.go
parentce2a609909d9de3391a99a00fe140506f724f933 (diff)
downloadgo-git-b94dc384cabf75e7e8703265cd80f5324f84b642.tar.gz
cmd/compile/internal/ir: explicit Pos for New{Bool,Int,String}
Stop depending on base.Pos for these. Change-Id: I58dea44f8141eb37b59a6e9f7db0c6baa516ad93 Reviewed-on: https://go-review.googlesource.com/c/go/+/472296 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/coverage/cover.go')
-rw-r--r--src/cmd/compile/internal/coverage/cover.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/coverage/cover.go b/src/cmd/compile/internal/coverage/cover.go
index 688728d53a..3e0350b51a 100644
--- a/src/cmd/compile/internal/coverage/cover.go
+++ b/src/cmd/compile/internal/coverage/cover.go
@@ -157,7 +157,7 @@ func registerMeta(cnames Names, hashv [16]byte, mdlen int) {
pos := cnames.InitFn.Pos()
elist := make([]ir.Node, 0, 16)
for i := 0; i < 16; i++ {
- elem := ir.NewInt(int64(hashv[i]))
+ elem := ir.NewInt(base.Pos, int64(hashv[i]))
elist = append(elist, elem)
}
ht := types.NewArray(types.Types[types.TUINT8], 16)
@@ -168,7 +168,7 @@ func registerMeta(cnames Names, hashv [16]byte, mdlen int) {
mdauspx := typecheck.ConvNop(mdax, types.Types[types.TUNSAFEPTR])
// Materialize expression for length.
- lenx := ir.NewInt(int64(mdlen)) // untyped
+ lenx := ir.NewInt(base.Pos, int64(mdlen)) // untyped
// Generate a call to runtime.addCovMeta, e.g.
//
@@ -176,10 +176,10 @@ func registerMeta(cnames Names, hashv [16]byte, mdlen int) {
//
fn := typecheck.LookupRuntime("addCovMeta")
pkid := coverage.HardCodedPkgID(base.Ctxt.Pkgpath)
- pkIdNode := ir.NewInt(int64(pkid))
- cmodeNode := ir.NewInt(int64(cnames.CounterMode))
- cgranNode := ir.NewInt(int64(cnames.CounterGran))
- pkPathNode := ir.NewString(base.Ctxt.Pkgpath)
+ pkIdNode := ir.NewInt(base.Pos, int64(pkid))
+ cmodeNode := ir.NewInt(base.Pos, int64(cnames.CounterMode))
+ cgranNode := ir.NewInt(base.Pos, int64(cnames.CounterGran))
+ pkPathNode := ir.NewString(base.Pos, base.Ctxt.Pkgpath)
callx := typecheck.Call(pos, fn, []ir.Node{mdauspx, lenx, hashx,
pkPathNode, pkIdNode, cmodeNode, cgranNode}, false)
assign := callx
@@ -202,7 +202,7 @@ func addInitHookCall(initfn *ir.Func, cmode coverage.CounterMode) {
pos := initfn.Pos()
istest := cmode == coverage.CtrModeTestMain
initf := typecheck.LookupCoverage("initHook")
- istestNode := ir.NewBool(istest)
+ istestNode := ir.NewBool(base.Pos, istest)
args := []ir.Node{istestNode}
callx := typecheck.Call(pos, initf, args, false)
initfn.Body.Append(callx)