mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
5045477be8
commit
ab9aaf46ee
8 changed files with 48 additions and 27 deletions
|
|
@ -194,16 +194,15 @@ func (pr *pkgReader) posBaseIdx(idx int) *src.PosBase {
|
|||
r := pr.newReader(relocPosBase, idx, syncPosBase)
|
||||
var b *src.PosBase
|
||||
|
||||
fn := r.string()
|
||||
absfn := r.string()
|
||||
filename := r.string()
|
||||
|
||||
if r.bool() {
|
||||
b = src.NewFileBase(fn, absfn)
|
||||
b = src.NewFileBase(filename, filename)
|
||||
} else {
|
||||
pos := r.pos0()
|
||||
line := r.uint()
|
||||
col := r.uint()
|
||||
b = src.NewLinePragmaBase(pos, fn, absfn, line, col)
|
||||
b = src.NewLinePragmaBase(pos, filename, filename, line, col)
|
||||
}
|
||||
|
||||
pr.posBases[idx] = b
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue