1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:14:40 -07:00
go/pointer
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
..
testdata go.tools/ssa: fix bad type info in 'for _ = range channel'. 2013-08-27 11:18:31 -04:00
analysis.go go.tools/importer: generalize command-line syntax. 2013-09-06 18:13:57 -04:00
api.go go.tools/oracle: describe: query content of lvalues, not their address. 2013-09-09 21:06:25 -04:00
callgraph.go go.tools/oracle: add option to output results in JSON syntax. 2013-09-03 15:29:02 -04:00
doc.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00
example_test.go go.tools/pointer: add runnable example. 2013-09-09 12:25:25 -04:00
gen.go go.tools/oracle: describe: query content of lvalues, not their address. 2013-09-09 21:06:25 -04:00
intrinsics.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00
labels.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00
pointer_test.go go.tools/importer: generalize command-line syntax. 2013-09-06 18:13:57 -04:00
print.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00
solve.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00
TODO go.tools/pointer: add runnable example. 2013-09-09 12:25:25 -04:00
util.go go.tools: add copyright messages to source files. 2013-08-27 18:49:13 -04:00