1
0
mirror of https://github.com/golang/go synced 2024-11-19 06:04:39 -07:00
go/oracle
Alan Donovan 927e0f9da6 go.tools/oracle: describe: query content of lvalues, not their address.
Background: some ssa.Values represent lvalues, e.g.
      var g = new(string)
the *ssa.Global g is a **string, the address of what users
think of as the global g.

Querying pts(g) returns a singleton containing the object g, a
*string.  What users really want to see is what that in turn
points to, i.e. the label for the call to new().

This change now lets users make "indirect" pointer queries,
i.e. for pts(*v) where v is an ssa.Value.  The oracle makes an
indirect query if the type of the ssa.Value differs from the
source expression type by a pointer, i.e. it's an lvalue.

In other words, we're hiding the fact that compilers (e.g. ssa) internally represent globals by their address.

+ Tests.

This serendipitously fixed an outstanding bug mentioned in the
describe.go

R=crawshaw
CC=golang-dev
https://golang.org/cl/13532043
2013-09-09 21:06:25 -04:00
..
json go.oracle: describe: disambiguate 'func' object kinds. 2013-09-04 16:15:41 -04:00
testdata/src go.tools/oracle: describe: query content of lvalues, not their address. 2013-09-09 21:06:25 -04:00
callees.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
callers.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
callgraph.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
callstack.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
describe.go go.tools/oracle: describe: query content of lvalues, not their address. 2013-09-09 21:06:25 -04:00
freevars.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
implements.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
oracle_test.go go.tools/cmd/oracle: use -pos=file:#start,#end syntax to indicate half-open [start,end) extent of byte offsets. 2013-09-08 22:10:11 -04:00
oracle.go go.tools/cmd/oracle: use -pos=file:#start,#end syntax to indicate half-open [start,end) extent of byte offsets. 2013-09-08 22:10:11 -04:00
peers.go go.tools/oracle: describe: query content of lvalues, not their address. 2013-09-09 21:06:25 -04:00