]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: add -trimpath flag allowing paths to be rewritten in outputs
authorMichael Matloob <matloob@golang.org>
Tue, 27 Oct 2020 21:51:58 +0000 (17:51 -0400)
committerMichael Matloob <matloob@golang.org>
Sat, 31 Oct 2020 00:35:18 +0000 (00:35 +0000)
commit79fb187be4d1a1a93c01b3a6be66ea529311ea84
tree821cab961132a52e17ff11e514ed83c7cbcc053d
parent07e4f0fd4b0f215cdfa7d6ea50f3e6402762a1a9
cmd/cgo: add -trimpath flag allowing paths to be rewritten in outputs

cmd/cgo now has a -trimpath flag that behaves the same as the
-trimpath flag to cmd/compile. This will be used to correct paths
to cgo files that are overlaid.

The code that processes trimpath in internal/objapi has been slightly
refactored because it's currently only accessible via AbsFile, which
does some additional processing to the path names. Now an
ApplyRewrites function is exported that just applies the trimpath
rewrites.

Also remove unused srcfile argument to cmd/cgo.(*Package).godefs.

For #39958

Change-Id: I497d48d0bc2fe1f6ab2b5835cbe79f15b839ee59
Reviewed-on: https://go-review.googlesource.com/c/go/+/266358
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/cgo/ast.go
src/cmd/cgo/godefs.go
src/cmd/cgo/main.go
src/cmd/internal/objabi/line.go