]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: adjust (*Link).AllPos comment in inl.go
authorDavid Chase <drchase@google.com>
Thu, 10 Nov 2022 16:45:23 +0000 (11:45 -0500)
committerDavid Chase <drchase@google.com>
Thu, 10 Nov 2022 17:44:41 +0000 (17:44 +0000)
AllPos truncates and overwrites its slice-storage input instead
of appending.  This makes that clear.

Change-Id: I81653ff49a4a7d14fe9446fd6620943f3b20bbd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/449478
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/internal/obj/inl.go

index de3c73d693f0b5cc273df5bb8da606c0766cc23e..934f1c26571136a8bb739b60d98b4161712abb33 100644 (file)
@@ -109,8 +109,9 @@ func (ctxt *Link) InnermostPos(xpos src.XPos) src.Pos {
 }
 
 // AllPos returns a slice of the positions inlined at xpos, from
-// innermost (index zero) to outermost.  To avoid gratuitous allocation
-// the result is passed in and extended if necessary.
+// innermost (index zero) to outermost.  To avoid allocation
+// the input slice is truncated, and used for the result, extended
+// as necessary.
 func (ctxt *Link) AllPos(xpos src.XPos, result []src.Pos) []src.Pos {
        pos := ctxt.InnermostPos(xpos)
        result = result[:0]