From: David Chase Date: Thu, 10 Nov 2022 16:45:23 +0000 (-0500) Subject: cmd/internal/obj: adjust (*Link).AllPos comment in inl.go X-Git-Tag: go1.20rc1~330 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2cea6cdb6016708e89c9472cdb0504731699681d;p=gostls13.git cmd/internal/obj: adjust (*Link).AllPos comment in inl.go 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 Reviewed-by: Keith Randall Run-TryBot: David Chase Reviewed-by: Keith Randall --- diff --git a/src/cmd/internal/obj/inl.go b/src/cmd/internal/obj/inl.go index de3c73d693..934f1c2657 100644 --- a/src/cmd/internal/obj/inl.go +++ b/src/cmd/internal/obj/inl.go @@ -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]