diff options
| author | David Chase <drchase@google.com> | 2022-11-10 11:45:23 -0500 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2022-11-10 17:44:41 +0000 |
| commit | 2cea6cdb6016708e89c9472cdb0504731699681d (patch) | |
| tree | 06959effe74fb34bbded6a725d09389527f2d995 /src/cmd/internal | |
| parent | 7717ac151ae1556541dddc6a817ac04733f1af44 (diff) | |
| download | go-2cea6cdb6016708e89c9472cdb0504731699681d.tar.xz | |
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 <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/internal')
| -rw-r--r-- | src/cmd/internal/obj/inl.go | 5 |
1 files changed, 3 insertions, 2 deletions
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] |
