aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYury Smolsky <yury@smolsky.by>2018-07-26 12:46:50 +0300
committerJosh Bleecher Snyder <josharian@gmail.com>2018-08-23 05:11:26 +0000
commitc374984e99888bb2e2dd6c331a1328275debe19d (patch)
tree1de2571adcb328e64364d4b06f366177e89f4d57 /src
parentc35069d6428d29b12088731aab35cbff1e504a28 (diff)
downloadgo-c374984e99888bb2e2dd6c331a1328275debe19d.tar.xz
cmd/compile: export the Func.Endlineno field
This CL exports the Func.Endlineno value for inlineable functions. It is needed to grab the source code of an imported function inlined into the function specified in $GOSSAFUNC. See CL 126606 for details. Updates #25904 Change-Id: I1e259e20445e4109b4621a95abb5bde1be457af1 Reviewed-on: https://go-review.googlesource.com/126605 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/iexport.go10
-rw-r--r--src/cmd/compile/internal/gc/iimport.go1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/iexport.go b/src/cmd/compile/internal/gc/iexport.go
index 5ce284dc73..3007c9cabf 100644
--- a/src/cmd/compile/internal/gc/iexport.go
+++ b/src/cmd/compile/internal/gc/iexport.go
@@ -952,6 +952,16 @@ func (w *exportWriter) funcExt(n *Node) {
if n.Func.ExportInline() {
w.p.doInline(n)
}
+
+ // Endlineno for inlined function.
+ if n.Name.Defn != nil {
+ w.pos(n.Name.Defn.Func.Endlineno)
+ } else {
+ // When the exported node was defined externally,
+ // e.g. io exports atomic.(*Value).Load or bytes exports errors.New.
+ // Keep it as we don't distinguish this case in iimport.go.
+ w.pos(n.Func.Endlineno)
+ }
} else {
w.uint64(0)
}
diff --git a/src/cmd/compile/internal/gc/iimport.go b/src/cmd/compile/internal/gc/iimport.go
index 21151b5215..6f0fd6b6d2 100644
--- a/src/cmd/compile/internal/gc/iimport.go
+++ b/src/cmd/compile/internal/gc/iimport.go
@@ -679,6 +679,7 @@ func (r *importReader) funcExt(n *Node) {
n.Func.Inl = &Inline{
Cost: int32(u - 1),
}
+ n.Func.Endlineno = r.pos()
}
}