]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/syntax: add PosBase.Trimmed
authorMatthew Dempsky <mdempsky@google.com>
Thu, 19 Aug 2021 22:52:53 +0000 (15:52 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 20 Aug 2021 19:44:02 +0000 (19:44 +0000)
commitab9aaf46ee5585317b5c796d6fb7e31383385eeb
tree8a98c158960acc0529656aa2a3d8f7bc8e9fcbe3
parent5045477be8961af1a5855d89e60483f4ccb624ac
cmd/compile/internal/syntax: add PosBase.Trimmed

With types2, some syntax.PosBases need to be constructed from export
data, which must only contain "trimmed" filenames (i.e., that they've
already been made absolute and undergone -trimpath processing).
However, it's not safe to apply trimming to a filename multiple times,
and in general we can't distinguish trimmed from untrimmed filenames.

This CL resolves this by adding a PosBase.Trimmed boolean so we can
distinguish whether the associated filename has been trimmed yet. This
is a bit hacky, but is the least bad solution I've come up with so
far.

This unblocks enabling -G=3 by default.

Change-Id: I7383becfb704680a36f7603e3246af38b21f100b
Reviewed-on: https://go-review.googlesource.com/c/go/+/343731
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/importer/iimport.go
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/noder/posmap.go
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/internal/noder/reader2.go
src/cmd/compile/internal/noder/writer.go
src/cmd/compile/internal/syntax/parser.go
src/cmd/compile/internal/syntax/pos.go