1
0
mirror of https://github.com/golang/go synced 2024-11-19 03:14:42 -07:00
go/oracle
Alan Donovan 9f640c2abb go.tools/ssa: record lvalue/rvalue distinction precisely in DebugRef.
A DebugRef associates a source expression E with an ssa.Value
V, but until now did not record whether V was the value or the
address of E.  So, we would guess from the "pointerness" of
the Value, leading to confusion in some cases, e.g.

   type N *N
   var n N
   n = &n  // lvalue and rvalue are both pointers

Now we explicitly record 'IsAddress bool' in DebugRef, and
plumb this everywhere: through (*Function).ValueForExpr and
(*Program).VarValue, all the way to forming the pointer
analysis query.

Also:
- VarValue now treats each reference to a global distinctly,
  just like it does for other vars.  So:
    var g int
    func f() {
   	g = 1     // VarValue(g) == Const(1:int), !isAddress
        print(g)  // VarValue(g) == Global(g), isAddress
    }
- DebugRefs are not emitted for references to predeclared
  identifiers (nil, built-in).
- DebugRefs no longer prevent lifting of an Alloc var into a
  register; now we update or discard the debug info.
- TestValueForExpr: improve coverage of ssa.EnclosingFunction
  by putting expectations in methods and init funcs, not just
  normal funcs.
- oracle: fix golden file broken by recent
  (*types.Var).IsField change.

R=gri
CC=golang-dev
https://golang.org/cl/16610045
2013-10-24 18:31:50 -04:00
..
serial go.tools/oracle: support -format=xml (for Eclipse) 2013-09-24 15:08:14 -04:00
testdata/src go.tools/ssa: record lvalue/rvalue distinction precisely in DebugRef. 2013-10-24 18:31:50 -04:00
callees.go go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
callers.go go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
callgraph.go go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
callstack.go go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
describe.go go.tools/ssa: record lvalue/rvalue distinction precisely in DebugRef. 2013-10-24 18:31:50 -04:00
freevars.go go.tools/oracle: change -mode argument into subcommand. 2013-09-25 14:34:39 -04:00
implements.go go.tools/oracle: support -format=xml (for Eclipse) 2013-09-24 15:08:14 -04:00
oracle_test.go go.tools/ssa: fix computation of set of types requiring method sets. 2013-10-23 17:07:52 -04:00
oracle.go go.tools/ssa: CreateTestMainPackage: synthesize test driver as a package ("testmain") not 'main' function. 2013-10-23 18:07:53 -04:00
peers.go go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
referrers.go go.tools/oracle: change -mode argument into subcommand. 2013-09-25 14:34:39 -04:00