From 3fc0fc1310d6e1d2ce061634e539fef038499eff Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Thu, 16 Jan 2014 09:33:58 -0500 Subject: [PATCH] go.tools: rename packages. Was: Now: ssa go/ssa importer go/loader pointer go/pointer Next CL: call -> go/callgraph (requires more care) R=gri, crawshaw CC=golang-codereviews https://golang.org/cl/52960043 --- astutil/enclosing.go | 2 +- call/call.go | 2 +- cmd/oracle/main.go | 4 +- cmd/ssadump/main.go | 10 ++--- {importer => go/loader}/importer_test.go | 8 ++-- importer/importer.go => go/loader/loader.go | 11 +++--- {importer => go/loader}/pkginfo.go | 2 +- {importer => go/loader}/source_test.go | 8 ++-- {importer => go/loader}/testdata/a.go | 0 {importer => go/loader}/testdata/b.go | 0 {importer => go/loader}/util.go | 2 +- {pointer => go/pointer}/TODO | 0 {pointer => go/pointer}/analysis.go | 2 +- {pointer => go/pointer}/api.go | 2 +- {pointer => go/pointer}/callgraph.go | 2 +- {pointer => go/pointer}/doc.go | 0 {pointer => go/pointer}/example_test.go | 10 ++--- {pointer => go/pointer}/gen.go | 2 +- {pointer => go/pointer}/intrinsics.go | 2 +- {pointer => go/pointer}/labels.go | 2 +- {pointer => go/pointer}/pointer_test.go | 8 ++-- {pointer => go/pointer}/print.go | 0 {pointer => go/pointer}/reflect.go | 2 +- {pointer => go/pointer}/solve.go | 0 {pointer => go/pointer}/testdata/a_test.go | 0 {pointer => go/pointer}/testdata/another.go | 0 .../pointer}/testdata/arrayreflect.go | 0 {pointer => go/pointer}/testdata/arrays.go | 0 {pointer => go/pointer}/testdata/channels.go | 0 .../pointer}/testdata/chanreflect.go | 0 .../pointer}/testdata/chanreflect1.go | 0 {pointer => go/pointer}/testdata/context.go | 0 {pointer => go/pointer}/testdata/conv.go | 0 {pointer => go/pointer}/testdata/finalizer.go | 0 {pointer => go/pointer}/testdata/flow.go | 0 .../pointer}/testdata/fmtexcerpt.go | 0 {pointer => go/pointer}/testdata/func.go | 0 .../pointer}/testdata/funcreflect.go | 0 {pointer => go/pointer}/testdata/hello.go | 0 .../pointer}/testdata/interfaces.go | 0 .../pointer}/testdata/mapreflect.go | 0 {pointer => go/pointer}/testdata/maps.go | 0 {pointer => go/pointer}/testdata/panic.go | 0 {pointer => go/pointer}/testdata/recur.go | 0 {pointer => go/pointer}/testdata/reflect.go | 0 {pointer => go/pointer}/testdata/rtti.go | 0 .../pointer}/testdata/structreflect.go | 0 {pointer => go/pointer}/testdata/structs.go | 0 {pointer => go/pointer}/util.go | 0 {ssa => go/ssa}/blockopt.go | 0 {ssa => go/ssa}/builder.go | 0 {ssa => go/ssa}/builder_test.go | 8 ++-- {ssa => go/ssa}/const.go | 0 {ssa => go/ssa}/create.go | 6 +-- {ssa => go/ssa}/doc.go | 4 +- {ssa => go/ssa}/dom.go | 0 {ssa => go/ssa}/emit.go | 0 {ssa => go/ssa}/example_test.go | 6 +-- {ssa => go/ssa}/func.go | 0 {ssa => go/ssa}/interp/external.go | 2 +- {ssa => go/ssa}/interp/external_plan9.go | 0 {ssa => go/ssa}/interp/external_unix.go | 2 +- {ssa => go/ssa}/interp/external_windows.go | 0 {ssa => go/ssa}/interp/interp.go | 2 +- {ssa => go/ssa}/interp/interp_test.go | 10 ++--- {ssa => go/ssa}/interp/map.go | 0 {ssa => go/ssa}/interp/ops.go | 2 +- {ssa => go/ssa}/interp/reflect.go | 2 +- {ssa => go/ssa}/interp/testdata/a_test.go | 0 {ssa => go/ssa}/interp/testdata/b_test.go | 0 {ssa => go/ssa}/interp/testdata/boundmeth.go | 0 {ssa => go/ssa}/interp/testdata/coverage.go | 0 {ssa => go/ssa}/interp/testdata/fieldprom.go | 0 {ssa => go/ssa}/interp/testdata/ifaceconv.go | 0 {ssa => go/ssa}/interp/testdata/ifaceprom.go | 0 {ssa => go/ssa}/interp/testdata/initorder.go | 0 {ssa => go/ssa}/interp/testdata/methprom.go | 0 {ssa => go/ssa}/interp/testdata/mrvchain.go | 0 {ssa => go/ssa}/interp/testdata/recover.go | 0 {ssa => go/ssa}/interp/value.go | 2 +- {ssa => go/ssa}/lift.go | 0 {ssa => go/ssa}/lvalue.go | 0 {ssa => go/ssa}/print.go | 0 {ssa => go/ssa}/promote.go | 0 {ssa => go/ssa}/sanity.go | 0 {ssa => go/ssa}/source.go | 2 +- {ssa => go/ssa}/source_test.go | 8 ++-- {ssa => go/ssa}/ssa.go | 10 ++--- {ssa => go/ssa}/ssautil/switch.go | 2 +- {ssa => go/ssa}/ssautil/switch_test.go | 8 ++-- {ssa => go/ssa}/ssautil/testdata/switches.go | 0 {ssa => go/ssa}/ssautil/visit.go | 2 +- {ssa => go/ssa}/stdlib_test.go | 8 ++-- {ssa => go/ssa}/testdata/objlookup.go | 0 {ssa => go/ssa}/testdata/valueforexpr.go | 0 {ssa => go/ssa}/testmain.go | 0 {ssa => go/ssa}/util.go | 0 oracle/callees.go | 2 +- oracle/callers.go | 2 +- oracle/callgraph.go | 2 +- oracle/callstack.go | 2 +- oracle/describe.go | 6 +-- oracle/oracle.go | 38 +++++++++---------- oracle/oracle_test.go | 6 +-- oracle/peers.go | 6 +-- oracle/pointsto.go | 10 ++--- 106 files changed, 120 insertions(+), 121 deletions(-) rename {importer => go/loader}/importer_test.go (92%) rename importer/importer.go => go/loader/loader.go (98%) rename {importer => go/loader}/pkginfo.go (99%) rename {importer => go/loader}/source_test.go (95%) rename {importer => go/loader}/testdata/a.go (100%) rename {importer => go/loader}/testdata/b.go (100%) rename {importer => go/loader}/util.go (99%) rename {pointer => go/pointer}/TODO (100%) rename {pointer => go/pointer}/analysis.go (99%) rename {pointer => go/pointer}/api.go (99%) rename {pointer => go/pointer}/callgraph.go (98%) rename {pointer => go/pointer}/doc.go (100%) rename {pointer => go/pointer}/example_test.go (91%) rename {pointer => go/pointer}/gen.go (99%) rename {pointer => go/pointer}/intrinsics.go (99%) rename {pointer => go/pointer}/labels.go (99%) rename {pointer => go/pointer}/pointer_test.go (98%) rename {pointer => go/pointer}/print.go (100%) rename {pointer => go/pointer}/reflect.go (99%) rename {pointer => go/pointer}/solve.go (100%) rename {pointer => go/pointer}/testdata/a_test.go (100%) rename {pointer => go/pointer}/testdata/another.go (100%) rename {pointer => go/pointer}/testdata/arrayreflect.go (100%) rename {pointer => go/pointer}/testdata/arrays.go (100%) rename {pointer => go/pointer}/testdata/channels.go (100%) rename {pointer => go/pointer}/testdata/chanreflect.go (100%) rename {pointer => go/pointer}/testdata/chanreflect1.go (100%) rename {pointer => go/pointer}/testdata/context.go (100%) rename {pointer => go/pointer}/testdata/conv.go (100%) rename {pointer => go/pointer}/testdata/finalizer.go (100%) rename {pointer => go/pointer}/testdata/flow.go (100%) rename {pointer => go/pointer}/testdata/fmtexcerpt.go (100%) rename {pointer => go/pointer}/testdata/func.go (100%) rename {pointer => go/pointer}/testdata/funcreflect.go (100%) rename {pointer => go/pointer}/testdata/hello.go (100%) rename {pointer => go/pointer}/testdata/interfaces.go (100%) rename {pointer => go/pointer}/testdata/mapreflect.go (100%) rename {pointer => go/pointer}/testdata/maps.go (100%) rename {pointer => go/pointer}/testdata/panic.go (100%) rename {pointer => go/pointer}/testdata/recur.go (100%) rename {pointer => go/pointer}/testdata/reflect.go (100%) rename {pointer => go/pointer}/testdata/rtti.go (100%) rename {pointer => go/pointer}/testdata/structreflect.go (100%) rename {pointer => go/pointer}/testdata/structs.go (100%) rename {pointer => go/pointer}/util.go (100%) rename {ssa => go/ssa}/blockopt.go (100%) rename {ssa => go/ssa}/builder.go (100%) rename {ssa => go/ssa}/builder_test.go (98%) rename {ssa => go/ssa}/const.go (100%) rename {ssa => go/ssa}/create.go (97%) rename {ssa => go/ssa}/doc.go (97%) rename {ssa => go/ssa}/dom.go (100%) rename {ssa => go/ssa}/emit.go (100%) rename {ssa => go/ssa}/example_test.go (96%) rename {ssa => go/ssa}/func.go (100%) rename {ssa => go/ssa}/interp/external.go (99%) rename {ssa => go/ssa}/interp/external_plan9.go (100%) rename {ssa => go/ssa}/interp/external_unix.go (98%) rename {ssa => go/ssa}/interp/external_windows.go (100%) rename {ssa => go/ssa}/interp/interp.go (99%) rename {ssa => go/ssa}/interp/interp_test.go (97%) rename {ssa => go/ssa}/interp/map.go (100%) rename {ssa => go/ssa}/interp/ops.go (99%) rename {ssa => go/ssa}/interp/reflect.go (99%) rename {ssa => go/ssa}/interp/testdata/a_test.go (100%) rename {ssa => go/ssa}/interp/testdata/b_test.go (100%) rename {ssa => go/ssa}/interp/testdata/boundmeth.go (100%) rename {ssa => go/ssa}/interp/testdata/coverage.go (100%) rename {ssa => go/ssa}/interp/testdata/fieldprom.go (100%) rename {ssa => go/ssa}/interp/testdata/ifaceconv.go (100%) rename {ssa => go/ssa}/interp/testdata/ifaceprom.go (100%) rename {ssa => go/ssa}/interp/testdata/initorder.go (100%) rename {ssa => go/ssa}/interp/testdata/methprom.go (100%) rename {ssa => go/ssa}/interp/testdata/mrvchain.go (100%) rename {ssa => go/ssa}/interp/testdata/recover.go (100%) rename {ssa => go/ssa}/interp/value.go (99%) rename {ssa => go/ssa}/lift.go (100%) rename {ssa => go/ssa}/lvalue.go (100%) rename {ssa => go/ssa}/print.go (100%) rename {ssa => go/ssa}/promote.go (100%) rename {ssa => go/ssa}/sanity.go (100%) rename {ssa => go/ssa}/source.go (99%) rename {ssa => go/ssa}/source_test.go (98%) rename {ssa => go/ssa}/ssa.go (99%) rename {ssa => go/ssa}/ssautil/switch.go (99%) rename {ssa => go/ssa}/ssautil/switch_test.go (91%) rename {ssa => go/ssa}/ssautil/testdata/switches.go (100%) rename {ssa => go/ssa}/ssautil/visit.go (97%) rename {ssa => go/ssa}/stdlib_test.go (95%) rename {ssa => go/ssa}/testdata/objlookup.go (100%) rename {ssa => go/ssa}/testdata/valueforexpr.go (100%) rename {ssa => go/ssa}/testmain.go (100%) rename {ssa => go/ssa}/util.go (100%) diff --git a/astutil/enclosing.go b/astutil/enclosing.go index d24ab606c..2de739efa 100644 --- a/astutil/enclosing.go +++ b/astutil/enclosing.go @@ -54,7 +54,7 @@ import ( // // Precondition: [start, end) both lie within the same file as root. // TODO(adonovan): return (nil, false) in this case and remove precond. -// Requires FileSet; see importer.tokenFileContainsPos. +// Requires FileSet; see loader.tokenFileContainsPos. // // Postcondition: path is never nil; it always contains at least 'root'. // diff --git a/call/call.go b/call/call.go index 0b21c24ae..10ea94392 100644 --- a/call/call.go +++ b/call/call.go @@ -58,7 +58,7 @@ language. */ package call -import "code.google.com/p/go.tools/ssa" +import "code.google.com/p/go.tools/go/ssa" // A Graph represents a call graph. // diff --git a/cmd/oracle/main.go b/cmd/oracle/main.go index 893360e89..d99f9dc1a 100644 --- a/cmd/oracle/main.go +++ b/cmd/oracle/main.go @@ -23,7 +23,7 @@ import ( "runtime" "runtime/pprof" - "code.google.com/p/go.tools/importer" + "code.google.com/p/go.tools/go/loader" "code.google.com/p/go.tools/oracle" ) @@ -74,7 +74,7 @@ Describe the syntax at offset 530 in this file (an import spec): Print the callgraph of the trivial web-server in JSON format: % oracle -format=json src/pkg/net/http/triv.go callgraph -` + importer.FromArgsUsage +` + loader.FromArgsUsage var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") diff --git a/cmd/ssadump/main.go b/cmd/ssadump/main.go index 28f25d647..3009bb7a0 100644 --- a/cmd/ssadump/main.go +++ b/cmd/ssadump/main.go @@ -14,10 +14,10 @@ import ( "runtime" "runtime/pprof" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" + "code.google.com/p/go.tools/go/ssa/interp" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" - "code.google.com/p/go.tools/ssa/interp" ) var buildFlag = flag.String("build", "", `Options controlling the SSA builder. @@ -48,7 +48,7 @@ Examples: % ssadump -build=FPG hello.go # quickly dump SSA form of a single package % ssadump -run -interp=T hello.go # interpret a program, with tracing % ssadump -run unicode -- -test.v # interpret the unicode package's tests, verbosely -` + importer.FromArgsUsage + +` + loader.FromArgsUsage + ` When -run is specified, ssadump will find the first package that defines a main function and run it in the interpreter. @@ -73,7 +73,7 @@ func main() { flag.Parse() args := flag.Args() - conf := importer.Config{ + conf := loader.Config{ Build: &build.Default, SourceImports: true, } diff --git a/importer/importer_test.go b/go/loader/importer_test.go similarity index 92% rename from importer/importer_test.go rename to go/loader/importer_test.go index e995df266..dbe9718d6 100644 --- a/importer/importer_test.go +++ b/go/loader/importer_test.go @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package importer_test +package loader_test import ( "fmt" "sort" "testing" - "code.google.com/p/go.tools/importer" + "code.google.com/p/go.tools/go/loader" ) -func loadFromArgs(args []string) (prog *importer.Program, rest []string, err error) { - conf := &importer.Config{} +func loadFromArgs(args []string) (prog *loader.Program, rest []string, err error) { + conf := &loader.Config{} rest, err = conf.FromArgs(args) if err == nil { prog, err = conf.Load() diff --git a/importer/importer.go b/go/loader/loader.go similarity index 98% rename from importer/importer.go rename to go/loader/loader.go index 0a86cc3ae..709bd20d2 100644 --- a/importer/importer.go +++ b/go/loader/loader.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package importer loads, parses and type-checks packages of Go code +// Package loader loads, parses and type-checks packages of Go code // plus their transitive closure, and retains both the ASTs and the // derived facts. // @@ -18,7 +18,7 @@ // be called any number of times. Finally, these are followed by a // call to Load() to actually load and type-check the program. // -// var conf importer.Config +// var conf loader.Config // // // Use the command-line arguments to specify // // a set of initial packages to load from source. @@ -70,7 +70,7 @@ // An external test package may depend upon members of the augmented // package that are not in the unaugmented package, such as functions // that expose internals. (See bufio/export_test.go for an example.) -// So, the importer must ensure that for each external test package +// So, the loader must ensure that for each external test package // it loads, it also augments the corresponding non-test package. // // The import graph over n unaugmented packages must be acyclic; the @@ -78,17 +78,16 @@ // package must also be acyclic. ('go test' relies on this.) But the // import graph over n augmented packages may contain cycles, and // currently, go/types is incapable of handling such inputs, so the -// Importer will only augment (and create an external test package +// loader will only augment (and create an external test package // for) the first import path specified on the command-line. // // The INITIAL packages are those specified in the configuration. A // DEPENDENCY is a package loaded to satisfy an import in an initial // package or another dependency. // -package importer +package loader // TODO(adonovan): -// - Rename this package go.tools/go/loader. // - (*Config).ParseFile is very handy, but feels like feature creep. // (*Config).CreateFromFiles has a nasty precondition. // - Ideally some of this logic would move under the umbrella of diff --git a/importer/pkginfo.go b/go/loader/pkginfo.go similarity index 99% rename from importer/pkginfo.go rename to go/loader/pkginfo.go index 6432080ad..ca25057e5 100644 --- a/importer/pkginfo.go +++ b/go/loader/pkginfo.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package importer +package loader import ( "fmt" diff --git a/importer/source_test.go b/go/loader/source_test.go similarity index 95% rename from importer/source_test.go rename to go/loader/source_test.go index bcb121c83..8a63ea510 100644 --- a/importer/source_test.go +++ b/go/loader/source_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package importer_test +package loader_test // This file defines tests of source utilities. @@ -14,8 +14,8 @@ import ( "testing" "code.google.com/p/go.tools/astutil" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" ) // findInterval parses input and returns the [start, end) positions of @@ -82,7 +82,7 @@ func TestEnclosingFunction(t *testing.T) { "900", "func@2.27"}, } for _, test := range tests { - conf := importer.Config{Fset: token.NewFileSet()} + conf := loader.Config{Fset: token.NewFileSet()} f, start, end := findInterval(t, conf.Fset, test.input, test.substr) if f == nil { continue diff --git a/importer/testdata/a.go b/go/loader/testdata/a.go similarity index 100% rename from importer/testdata/a.go rename to go/loader/testdata/a.go diff --git a/importer/testdata/b.go b/go/loader/testdata/b.go similarity index 100% rename from importer/testdata/b.go rename to go/loader/testdata/b.go diff --git a/importer/util.go b/go/loader/util.go similarity index 99% rename from importer/util.go rename to go/loader/util.go index b824f5732..e17c8a42e 100644 --- a/importer/util.go +++ b/go/loader/util.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package importer +package loader // This file defines various utility functions exposed by the package // and used by it. diff --git a/pointer/TODO b/go/pointer/TODO similarity index 100% rename from pointer/TODO rename to go/pointer/TODO diff --git a/pointer/analysis.go b/go/pointer/analysis.go similarity index 99% rename from pointer/analysis.go rename to go/pointer/analysis.go index e88ad58dd..1995c8de2 100644 --- a/pointer/analysis.go +++ b/go/pointer/analysis.go @@ -13,9 +13,9 @@ import ( "os" "reflect" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/go/types/typemap" - "code.google.com/p/go.tools/ssa" ) // object.flags bitmask values. diff --git a/pointer/api.go b/go/pointer/api.go similarity index 99% rename from pointer/api.go rename to go/pointer/api.go index a89fbd144..95c1fe6ef 100644 --- a/pointer/api.go +++ b/go/pointer/api.go @@ -11,8 +11,8 @@ import ( "io" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types/typemap" - "code.google.com/p/go.tools/ssa" ) // A Config formulates a pointer analysis problem for Analyze(). diff --git a/pointer/callgraph.go b/go/pointer/callgraph.go similarity index 98% rename from pointer/callgraph.go rename to go/pointer/callgraph.go index c17812a95..910affbb2 100644 --- a/pointer/callgraph.go +++ b/go/pointer/callgraph.go @@ -11,7 +11,7 @@ import ( "go/token" "code.google.com/p/go.tools/call" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/ssa" ) // cgraph implements call.Graph. diff --git a/pointer/doc.go b/go/pointer/doc.go similarity index 100% rename from pointer/doc.go rename to go/pointer/doc.go diff --git a/pointer/example_test.go b/go/pointer/example_test.go similarity index 91% rename from pointer/example_test.go rename to go/pointer/example_test.go index 4b476b2af..dd82b12e2 100644 --- a/pointer/example_test.go +++ b/go/pointer/example_test.go @@ -9,9 +9,9 @@ import ( "sort" "code.google.com/p/go.tools/call" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/pointer" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/pointer" + "code.google.com/p/go.tools/go/ssa" ) // This program demonstrates how to use the pointer analysis to @@ -38,8 +38,8 @@ func main() { i.f() // dynamic method call } ` - // Construct an importer. - conf := importer.Config{SourceImports: true} + // Construct a loader. + conf := loader.Config{SourceImports: true} // Parse the input file. file, err := conf.ParseFile("myprog.go", myprog, 0) diff --git a/pointer/gen.go b/go/pointer/gen.go similarity index 99% rename from pointer/gen.go rename to go/pointer/gen.go index c2bd4eb7d..bfb3bf99b 100644 --- a/pointer/gen.go +++ b/go/pointer/gen.go @@ -14,8 +14,8 @@ import ( "fmt" "go/token" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) var ( diff --git a/pointer/intrinsics.go b/go/pointer/intrinsics.go similarity index 99% rename from pointer/intrinsics.go rename to go/pointer/intrinsics.go index eb9c7356b..25c708713 100644 --- a/pointer/intrinsics.go +++ b/go/pointer/intrinsics.go @@ -18,8 +18,8 @@ package pointer import ( "fmt" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) // Instances of 'intrinsic' generate analysis constraints for calls to diff --git a/pointer/labels.go b/go/pointer/labels.go similarity index 99% rename from pointer/labels.go rename to go/pointer/labels.go index da3e2350f..63026bfb4 100644 --- a/pointer/labels.go +++ b/go/pointer/labels.go @@ -10,8 +10,8 @@ import ( "strings" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) // A Label is an entity that may be pointed to by a pointer, map, diff --git a/pointer/pointer_test.go b/go/pointer/pointer_test.go similarity index 98% rename from pointer/pointer_test.go rename to go/pointer/pointer_test.go index 36ba87074..4b6d70ef5 100644 --- a/pointer/pointer_test.go +++ b/go/pointer/pointer_test.go @@ -22,11 +22,11 @@ import ( "testing" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/pointer" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/go/types/typemap" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/pointer" - "code.google.com/p/go.tools/ssa" ) var inputs = []string{ @@ -151,7 +151,7 @@ func findProbe(prog *ssa.Program, probes map[*ssa.CallCommon]pointer.Pointer, e } func doOneInput(input, filename string) bool { - conf := importer.Config{SourceImports: true} + conf := loader.Config{SourceImports: true} // Parsing. f, err := conf.ParseFile(filename, input, 0) diff --git a/pointer/print.go b/go/pointer/print.go similarity index 100% rename from pointer/print.go rename to go/pointer/print.go diff --git a/pointer/reflect.go b/go/pointer/reflect.go similarity index 99% rename from pointer/reflect.go rename to go/pointer/reflect.go index 38f631cb6..b9e688f1b 100644 --- a/pointer/reflect.go +++ b/go/pointer/reflect.go @@ -28,8 +28,8 @@ import ( "reflect" "code.google.com/p/go.tools/go/exact" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) // -------------------- (reflect.Value) -------------------- diff --git a/pointer/solve.go b/go/pointer/solve.go similarity index 100% rename from pointer/solve.go rename to go/pointer/solve.go diff --git a/pointer/testdata/a_test.go b/go/pointer/testdata/a_test.go similarity index 100% rename from pointer/testdata/a_test.go rename to go/pointer/testdata/a_test.go diff --git a/pointer/testdata/another.go b/go/pointer/testdata/another.go similarity index 100% rename from pointer/testdata/another.go rename to go/pointer/testdata/another.go diff --git a/pointer/testdata/arrayreflect.go b/go/pointer/testdata/arrayreflect.go similarity index 100% rename from pointer/testdata/arrayreflect.go rename to go/pointer/testdata/arrayreflect.go diff --git a/pointer/testdata/arrays.go b/go/pointer/testdata/arrays.go similarity index 100% rename from pointer/testdata/arrays.go rename to go/pointer/testdata/arrays.go diff --git a/pointer/testdata/channels.go b/go/pointer/testdata/channels.go similarity index 100% rename from pointer/testdata/channels.go rename to go/pointer/testdata/channels.go diff --git a/pointer/testdata/chanreflect.go b/go/pointer/testdata/chanreflect.go similarity index 100% rename from pointer/testdata/chanreflect.go rename to go/pointer/testdata/chanreflect.go diff --git a/pointer/testdata/chanreflect1.go b/go/pointer/testdata/chanreflect1.go similarity index 100% rename from pointer/testdata/chanreflect1.go rename to go/pointer/testdata/chanreflect1.go diff --git a/pointer/testdata/context.go b/go/pointer/testdata/context.go similarity index 100% rename from pointer/testdata/context.go rename to go/pointer/testdata/context.go diff --git a/pointer/testdata/conv.go b/go/pointer/testdata/conv.go similarity index 100% rename from pointer/testdata/conv.go rename to go/pointer/testdata/conv.go diff --git a/pointer/testdata/finalizer.go b/go/pointer/testdata/finalizer.go similarity index 100% rename from pointer/testdata/finalizer.go rename to go/pointer/testdata/finalizer.go diff --git a/pointer/testdata/flow.go b/go/pointer/testdata/flow.go similarity index 100% rename from pointer/testdata/flow.go rename to go/pointer/testdata/flow.go diff --git a/pointer/testdata/fmtexcerpt.go b/go/pointer/testdata/fmtexcerpt.go similarity index 100% rename from pointer/testdata/fmtexcerpt.go rename to go/pointer/testdata/fmtexcerpt.go diff --git a/pointer/testdata/func.go b/go/pointer/testdata/func.go similarity index 100% rename from pointer/testdata/func.go rename to go/pointer/testdata/func.go diff --git a/pointer/testdata/funcreflect.go b/go/pointer/testdata/funcreflect.go similarity index 100% rename from pointer/testdata/funcreflect.go rename to go/pointer/testdata/funcreflect.go diff --git a/pointer/testdata/hello.go b/go/pointer/testdata/hello.go similarity index 100% rename from pointer/testdata/hello.go rename to go/pointer/testdata/hello.go diff --git a/pointer/testdata/interfaces.go b/go/pointer/testdata/interfaces.go similarity index 100% rename from pointer/testdata/interfaces.go rename to go/pointer/testdata/interfaces.go diff --git a/pointer/testdata/mapreflect.go b/go/pointer/testdata/mapreflect.go similarity index 100% rename from pointer/testdata/mapreflect.go rename to go/pointer/testdata/mapreflect.go diff --git a/pointer/testdata/maps.go b/go/pointer/testdata/maps.go similarity index 100% rename from pointer/testdata/maps.go rename to go/pointer/testdata/maps.go diff --git a/pointer/testdata/panic.go b/go/pointer/testdata/panic.go similarity index 100% rename from pointer/testdata/panic.go rename to go/pointer/testdata/panic.go diff --git a/pointer/testdata/recur.go b/go/pointer/testdata/recur.go similarity index 100% rename from pointer/testdata/recur.go rename to go/pointer/testdata/recur.go diff --git a/pointer/testdata/reflect.go b/go/pointer/testdata/reflect.go similarity index 100% rename from pointer/testdata/reflect.go rename to go/pointer/testdata/reflect.go diff --git a/pointer/testdata/rtti.go b/go/pointer/testdata/rtti.go similarity index 100% rename from pointer/testdata/rtti.go rename to go/pointer/testdata/rtti.go diff --git a/pointer/testdata/structreflect.go b/go/pointer/testdata/structreflect.go similarity index 100% rename from pointer/testdata/structreflect.go rename to go/pointer/testdata/structreflect.go diff --git a/pointer/testdata/structs.go b/go/pointer/testdata/structs.go similarity index 100% rename from pointer/testdata/structs.go rename to go/pointer/testdata/structs.go diff --git a/pointer/util.go b/go/pointer/util.go similarity index 100% rename from pointer/util.go rename to go/pointer/util.go diff --git a/ssa/blockopt.go b/go/ssa/blockopt.go similarity index 100% rename from ssa/blockopt.go rename to go/ssa/blockopt.go diff --git a/ssa/builder.go b/go/ssa/builder.go similarity index 100% rename from ssa/builder.go rename to go/ssa/builder.go diff --git a/ssa/builder_test.go b/go/ssa/builder_test.go similarity index 98% rename from ssa/builder_test.go rename to go/ssa/builder_test.go index 490e08546..6421cb877 100644 --- a/ssa/builder_test.go +++ b/go/ssa/builder_test.go @@ -10,9 +10,9 @@ import ( "strings" "testing" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" ) func isEmpty(f *ssa.Function) bool { return f.Blocks == nil } @@ -41,7 +41,7 @@ func main() { ` // Create a single-file main package. - var conf importer.Config + var conf loader.Config f, err := conf.ParseFile("", test, 0) if err != nil { t.Error(err) @@ -206,7 +206,7 @@ func TestTypesWithMethodSets(t *testing.T) { } for i, test := range tests { // Create a single-file main package. - var conf importer.Config + var conf loader.Config f, err := conf.ParseFile("", test.input, 0) if err != nil { t.Errorf("test %d: %s", i, err) diff --git a/ssa/const.go b/go/ssa/const.go similarity index 100% rename from ssa/const.go rename to go/ssa/const.go diff --git a/ssa/create.go b/go/ssa/create.go similarity index 97% rename from ssa/create.go rename to go/ssa/create.go index 60b2986c9..4abbad2e8 100644 --- a/ssa/create.go +++ b/go/ssa/create.go @@ -12,8 +12,8 @@ import ( "go/token" "os" + "code.google.com/p/go.tools/go/loader" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" ) // BuilderMode is a bitmask of options for diagnostics and checking. @@ -37,7 +37,7 @@ const ( // // mode controls diagnostics and checking during SSA construction. // -func Create(iprog *importer.Program, mode BuilderMode) *Program { +func Create(iprog *loader.Program, mode BuilderMode) *Program { prog := &Program{ Fset: iprog.Fset, imported: make(map[string]*Package), @@ -170,7 +170,7 @@ func membersFromDecl(pkg *Package, decl ast.Decl) { // The real work of building SSA form for each function is not done // until a subsequent call to Package.Build(). // -func (prog *Program) CreatePackage(info *importer.PackageInfo) *Package { +func (prog *Program) CreatePackage(info *loader.PackageInfo) *Package { if p := prog.packages[info.Pkg]; p != nil { return p // already loaded } diff --git a/ssa/doc.go b/go/ssa/doc.go similarity index 97% rename from ssa/doc.go rename to go/ssa/doc.go index 82047875e..83c29122e 100644 --- a/ssa/doc.go +++ b/go/ssa/doc.go @@ -23,8 +23,8 @@ // primitives in the future to facilitate constant-time dispatch of // switch statements, for example. // -// To construct an SSA-form program, call ssa.Create on an -// importer.Program, a set of type-checked packages created from +// To construct an SSA-form program, call ssa.Create on a +// loader.Program, a set of type-checked packages created from // parsed Go source files. The resulting ssa.Program contains all the // packages and their members, but SSA code is not created for // function bodies until a subsequent call to (*Package).Build. diff --git a/ssa/dom.go b/go/ssa/dom.go similarity index 100% rename from ssa/dom.go rename to go/ssa/dom.go diff --git a/ssa/emit.go b/go/ssa/emit.go similarity index 100% rename from ssa/emit.go rename to go/ssa/emit.go diff --git a/ssa/example_test.go b/go/ssa/example_test.go similarity index 96% rename from ssa/example_test.go rename to go/ssa/example_test.go index 20383ad38..d294ce2ae 100644 --- a/ssa/example_test.go +++ b/go/ssa/example_test.go @@ -8,8 +8,8 @@ import ( "fmt" "os" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" ) // This program demonstrates how to run the SSA builder on a "Hello, @@ -40,7 +40,7 @@ func main() { fmt.Println(message) } ` - var conf importer.Config + var conf loader.Config // Parse the input file. file, err := conf.ParseFile("hello.go", hello, 0) diff --git a/ssa/func.go b/go/ssa/func.go similarity index 100% rename from ssa/func.go rename to go/ssa/func.go diff --git a/ssa/interp/external.go b/go/ssa/interp/external.go similarity index 99% rename from ssa/interp/external.go rename to go/ssa/interp/external.go index 8df7cf546..172294feb 100644 --- a/ssa/interp/external.go +++ b/go/ssa/interp/external.go @@ -14,7 +14,7 @@ import ( "syscall" "time" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/ssa" ) type externalFn func(fn *ssa.Function, args []value) value diff --git a/ssa/interp/external_plan9.go b/go/ssa/interp/external_plan9.go similarity index 100% rename from ssa/interp/external_plan9.go rename to go/ssa/interp/external_plan9.go diff --git a/ssa/interp/external_unix.go b/go/ssa/interp/external_unix.go similarity index 98% rename from ssa/interp/external_unix.go rename to go/ssa/interp/external_unix.go index 8b6f4a7da..efd50fbda 100644 --- a/ssa/interp/external_unix.go +++ b/go/ssa/interp/external_unix.go @@ -9,7 +9,7 @@ package interp import ( "syscall" - "code.google.com/p/go.tools/ssa" + "code.google.com/p/go.tools/go/ssa" ) func fillStat(st *syscall.Stat_t, stat structure) { diff --git a/ssa/interp/external_windows.go b/go/ssa/interp/external_windows.go similarity index 100% rename from ssa/interp/external_windows.go rename to go/ssa/interp/external_windows.go diff --git a/ssa/interp/interp.go b/go/ssa/interp/interp.go similarity index 99% rename from ssa/interp/interp.go rename to go/ssa/interp/interp.go index 82ed0e03b..20988cd8c 100644 --- a/ssa/interp/interp.go +++ b/go/ssa/interp/interp.go @@ -51,8 +51,8 @@ import ( "reflect" "runtime" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) type continuation int diff --git a/ssa/interp/interp_test.go b/go/ssa/interp/interp_test.go similarity index 97% rename from ssa/interp/interp_test.go rename to go/ssa/interp/interp_test.go index 515db6191..4c1d43520 100644 --- a/ssa/interp/interp_test.go +++ b/go/ssa/interp/interp_test.go @@ -16,10 +16,10 @@ import ( "testing" "time" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" + "code.google.com/p/go.tools/go/ssa/interp" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" - "code.google.com/p/go.tools/ssa/interp" ) // Each line contains a space-separated list of $GOROOT/test/ @@ -168,7 +168,7 @@ func run(t *testing.T, dir, input string, success successPredicate) bool { inputs = append(inputs, dir+i) } - conf := importer.Config{SourceImports: true} + conf := loader.Config{SourceImports: true} // TODO(adonovan): add the following packages' tests, which pass: // "flag", "unicode", "unicode/utf8", "testing", "log", "path". if err := conf.CreateFromFilenames(inputs...); err != nil { @@ -318,7 +318,7 @@ func TestTestmainPackage(t *testing.T) { // CreateTestMainPackage should return nil if there were no tests. func TestNullTestmainPackage(t *testing.T) { - var conf importer.Config + var conf loader.Config if err := conf.CreateFromFilenames("testdata/b_test.go"); err != nil { t.Fatalf("ParseFile failed: %s", err) } diff --git a/ssa/interp/map.go b/go/ssa/interp/map.go similarity index 100% rename from ssa/interp/map.go rename to go/ssa/interp/map.go diff --git a/ssa/interp/ops.go b/go/ssa/interp/ops.go similarity index 99% rename from ssa/interp/ops.go rename to go/ssa/interp/ops.go index 7842dda7a..717120485 100644 --- a/ssa/interp/ops.go +++ b/go/ssa/interp/ops.go @@ -13,8 +13,8 @@ import ( "unsafe" "code.google.com/p/go.tools/go/exact" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) // If the target program panics, the interpreter panics with this type. diff --git a/ssa/interp/reflect.go b/go/ssa/interp/reflect.go similarity index 99% rename from ssa/interp/reflect.go rename to go/ssa/interp/reflect.go index 556d80362..98dabc466 100644 --- a/ssa/interp/reflect.go +++ b/go/ssa/interp/reflect.go @@ -16,8 +16,8 @@ import ( "reflect" "unsafe" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) type opaqueType struct { diff --git a/ssa/interp/testdata/a_test.go b/go/ssa/interp/testdata/a_test.go similarity index 100% rename from ssa/interp/testdata/a_test.go rename to go/ssa/interp/testdata/a_test.go diff --git a/ssa/interp/testdata/b_test.go b/go/ssa/interp/testdata/b_test.go similarity index 100% rename from ssa/interp/testdata/b_test.go rename to go/ssa/interp/testdata/b_test.go diff --git a/ssa/interp/testdata/boundmeth.go b/go/ssa/interp/testdata/boundmeth.go similarity index 100% rename from ssa/interp/testdata/boundmeth.go rename to go/ssa/interp/testdata/boundmeth.go diff --git a/ssa/interp/testdata/coverage.go b/go/ssa/interp/testdata/coverage.go similarity index 100% rename from ssa/interp/testdata/coverage.go rename to go/ssa/interp/testdata/coverage.go diff --git a/ssa/interp/testdata/fieldprom.go b/go/ssa/interp/testdata/fieldprom.go similarity index 100% rename from ssa/interp/testdata/fieldprom.go rename to go/ssa/interp/testdata/fieldprom.go diff --git a/ssa/interp/testdata/ifaceconv.go b/go/ssa/interp/testdata/ifaceconv.go similarity index 100% rename from ssa/interp/testdata/ifaceconv.go rename to go/ssa/interp/testdata/ifaceconv.go diff --git a/ssa/interp/testdata/ifaceprom.go b/go/ssa/interp/testdata/ifaceprom.go similarity index 100% rename from ssa/interp/testdata/ifaceprom.go rename to go/ssa/interp/testdata/ifaceprom.go diff --git a/ssa/interp/testdata/initorder.go b/go/ssa/interp/testdata/initorder.go similarity index 100% rename from ssa/interp/testdata/initorder.go rename to go/ssa/interp/testdata/initorder.go diff --git a/ssa/interp/testdata/methprom.go b/go/ssa/interp/testdata/methprom.go similarity index 100% rename from ssa/interp/testdata/methprom.go rename to go/ssa/interp/testdata/methprom.go diff --git a/ssa/interp/testdata/mrvchain.go b/go/ssa/interp/testdata/mrvchain.go similarity index 100% rename from ssa/interp/testdata/mrvchain.go rename to go/ssa/interp/testdata/mrvchain.go diff --git a/ssa/interp/testdata/recover.go b/go/ssa/interp/testdata/recover.go similarity index 100% rename from ssa/interp/testdata/recover.go rename to go/ssa/interp/testdata/recover.go diff --git a/ssa/interp/value.go b/go/ssa/interp/value.go similarity index 99% rename from ssa/interp/value.go rename to go/ssa/interp/value.go index 8ec95a50a..912b09d12 100644 --- a/ssa/interp/value.go +++ b/go/ssa/interp/value.go @@ -42,9 +42,9 @@ import ( "sync" "unsafe" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/go/types/typemap" - "code.google.com/p/go.tools/ssa" ) type value interface{} diff --git a/ssa/lift.go b/go/ssa/lift.go similarity index 100% rename from ssa/lift.go rename to go/ssa/lift.go diff --git a/ssa/lvalue.go b/go/ssa/lvalue.go similarity index 100% rename from ssa/lvalue.go rename to go/ssa/lvalue.go diff --git a/ssa/print.go b/go/ssa/print.go similarity index 100% rename from ssa/print.go rename to go/ssa/print.go diff --git a/ssa/promote.go b/go/ssa/promote.go similarity index 100% rename from ssa/promote.go rename to go/ssa/promote.go diff --git a/ssa/sanity.go b/go/ssa/sanity.go similarity index 100% rename from ssa/sanity.go rename to go/ssa/sanity.go diff --git a/ssa/source.go b/go/ssa/source.go similarity index 99% rename from ssa/source.go rename to go/ssa/source.go index 051d9012e..6dd667e48 100644 --- a/ssa/source.go +++ b/go/ssa/source.go @@ -140,7 +140,7 @@ func findNamedFunc(pkg *Package, pos token.Pos) *Function { // - f was not built with debug information; or // - e is a constant expression. (For efficiency, no debug // information is stored for constants. Use -// importer.PackageInfo.ValueOf(e) instead.) +// loader.PackageInfo.ValueOf(e) instead.) // - e is a reference to nil or a built-in function. // - the value was optimised away. // diff --git a/ssa/source_test.go b/go/ssa/source_test.go similarity index 98% rename from ssa/source_test.go rename to go/ssa/source_test.go index 17ba439c8..541550449 100644 --- a/ssa/source_test.go +++ b/go/ssa/source_test.go @@ -18,13 +18,13 @@ import ( "code.google.com/p/go.tools/astutil" "code.google.com/p/go.tools/go/exact" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" ) func TestObjValueLookup(t *testing.T) { - var conf importer.Config + var conf loader.Config f, err := conf.ParseFile("testdata/objlookup.go", nil, parser.ParseComments) if err != nil { t.Error(err) @@ -188,7 +188,7 @@ func checkVarValue(t *testing.T, prog *ssa.Program, pkg *ssa.Package, ref []ast. // Ensure that, in debug mode, we can determine the ssa.Value // corresponding to every ast.Expr. func TestValueForExpr(t *testing.T) { - var conf importer.Config + var conf loader.Config f, err := conf.ParseFile("testdata/valueforexpr.go", nil, parser.ParseComments) if err != nil { t.Error(err) diff --git a/ssa/ssa.go b/go/ssa/ssa.go similarity index 99% rename from ssa/ssa.go rename to go/ssa/ssa.go index 111af6946..249789c0e 100644 --- a/ssa/ssa.go +++ b/go/ssa/ssa.go @@ -14,9 +14,9 @@ import ( "sync" "code.google.com/p/go.tools/go/exact" + "code.google.com/p/go.tools/go/loader" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/go/types/typemap" - "code.google.com/p/go.tools/importer" ) // A Program is a partial or complete Go program converted to SSA form. @@ -49,10 +49,10 @@ type Package struct { // The following fields are set transiently, then cleared // after building. - started int32 // atomically tested and set at start of build phase - ninit int32 // number of init functions - info *importer.PackageInfo // package ASTs and type information - needRTTI typemap.M // types for which runtime type info is needed + started int32 // atomically tested and set at start of build phase + ninit int32 // number of init functions + info *loader.PackageInfo // package ASTs and type information + needRTTI typemap.M // types for which runtime type info is needed } // A Member is a member of a Go package, implemented by *NamedConst, diff --git a/ssa/ssautil/switch.go b/go/ssa/ssautil/switch.go similarity index 99% rename from ssa/ssautil/switch.go rename to go/ssa/ssautil/switch.go index 4af2da911..ae030c497 100644 --- a/ssa/ssautil/switch.go +++ b/go/ssa/ssautil/switch.go @@ -23,8 +23,8 @@ import ( "fmt" "go/token" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/ssa" ) // A ConstCase represents a single constant comparison. diff --git a/ssa/ssautil/switch_test.go b/go/ssa/ssautil/switch_test.go similarity index 91% rename from ssa/ssautil/switch_test.go rename to go/ssa/ssautil/switch_test.go index c41a3f280..5a4b38fff 100644 --- a/ssa/ssautil/switch_test.go +++ b/go/ssa/ssautil/switch_test.go @@ -9,13 +9,13 @@ import ( "strings" "testing" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" - "code.google.com/p/go.tools/ssa/ssautil" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" + "code.google.com/p/go.tools/go/ssa/ssautil" ) func TestSwitches(t *testing.T) { - var conf importer.Config + var conf loader.Config f, err := conf.ParseFile("testdata/switches.go", nil, parser.ParseComments) if err != nil { t.Error(err) diff --git a/ssa/ssautil/testdata/switches.go b/go/ssa/ssautil/testdata/switches.go similarity index 100% rename from ssa/ssautil/testdata/switches.go rename to go/ssa/ssautil/testdata/switches.go diff --git a/ssa/ssautil/visit.go b/go/ssa/ssautil/visit.go similarity index 97% rename from ssa/ssautil/visit.go rename to go/ssa/ssautil/visit.go index 6cb51b425..f202148bb 100644 --- a/ssa/ssautil/visit.go +++ b/go/ssa/ssautil/visit.go @@ -4,7 +4,7 @@ package ssautil -import "code.google.com/p/go.tools/ssa" +import "code.google.com/p/go.tools/go/ssa" // This file defines utilities for visiting the SSA representation of // a Program. diff --git a/ssa/stdlib_test.go b/go/ssa/stdlib_test.go similarity index 95% rename from ssa/stdlib_test.go rename to go/ssa/stdlib_test.go index f95e3669c..c13cbaa6e 100644 --- a/ssa/stdlib_test.go +++ b/go/ssa/stdlib_test.go @@ -18,9 +18,9 @@ import ( "testing" "time" - "code.google.com/p/go.tools/importer" - "code.google.com/p/go.tools/ssa" - "code.google.com/p/go.tools/ssa/ssautil" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" + "code.google.com/p/go.tools/go/ssa/ssautil" ) func allPackages() []string { @@ -52,7 +52,7 @@ func TestStdlib(t *testing.T) { // Load, parse and type-check the program. t0 := time.Now() - var conf importer.Config + var conf loader.Config if _, err := conf.FromArgs(allPackages()); err != nil { t.Errorf("FromArgs failed: %s", err) return diff --git a/ssa/testdata/objlookup.go b/go/ssa/testdata/objlookup.go similarity index 100% rename from ssa/testdata/objlookup.go rename to go/ssa/testdata/objlookup.go diff --git a/ssa/testdata/valueforexpr.go b/go/ssa/testdata/valueforexpr.go similarity index 100% rename from ssa/testdata/valueforexpr.go rename to go/ssa/testdata/valueforexpr.go diff --git a/ssa/testmain.go b/go/ssa/testmain.go similarity index 100% rename from ssa/testmain.go rename to go/ssa/testmain.go diff --git a/ssa/util.go b/go/ssa/util.go similarity index 100% rename from ssa/util.go rename to go/ssa/util.go diff --git a/oracle/callees.go b/oracle/callees.go index d3507e837..fc08ce2dc 100644 --- a/oracle/callees.go +++ b/oracle/callees.go @@ -10,9 +10,9 @@ import ( "go/token" "sort" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/ssa" ) // Callees reports the possible callees of the function call site diff --git a/oracle/callers.go b/oracle/callers.go index 0236fab08..2ce88b3a6 100644 --- a/oracle/callers.go +++ b/oracle/callers.go @@ -9,8 +9,8 @@ import ( "go/token" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/ssa" ) // Callers reports the possible callers of the function diff --git a/oracle/callgraph.go b/oracle/callgraph.go index 91b05d276..621e19ef7 100644 --- a/oracle/callgraph.go +++ b/oracle/callgraph.go @@ -9,8 +9,8 @@ import ( "sort" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/ssa" ) // callgraph displays the entire callgraph of the current program. diff --git a/oracle/callstack.go b/oracle/callstack.go index 38dcdaf92..383d56077 100644 --- a/oracle/callstack.go +++ b/oracle/callstack.go @@ -9,8 +9,8 @@ import ( "go/token" "code.google.com/p/go.tools/call" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/ssa" ) // Callstack displays an arbitrary path from a root of the callgraph diff --git a/oracle/describe.go b/oracle/describe.go index 11d4fe7a2..3d671092b 100644 --- a/oracle/describe.go +++ b/oracle/describe.go @@ -14,10 +14,10 @@ import ( "code.google.com/p/go.tools/astutil" "code.google.com/p/go.tools/go/exact" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/ssa" ) // describe describes the syntax node denoted by the query position, @@ -90,7 +90,7 @@ const ( // and returns the most "interesting" associated node, which may be // the same node, an ancestor or a descendent. // -func findInterestingNode(pkginfo *importer.PackageInfo, path []ast.Node) ([]ast.Node, action) { +func findInterestingNode(pkginfo *loader.PackageInfo, path []ast.Node) ([]ast.Node, action) { // TODO(adonovan): integrate with go/types/stdlib_test.go and // apply this to every AST node we can find to make sure it // doesn't crash. diff --git a/oracle/oracle.go b/oracle/oracle.go index eeb7103b6..9c41ac975 100644 --- a/oracle/oracle.go +++ b/oracle/oracle.go @@ -57,19 +57,19 @@ import ( "io" "code.google.com/p/go.tools/astutil" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/pointer" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/pointer" - "code.google.com/p/go.tools/ssa" ) // An Oracle holds the program state required for one or more queries. type Oracle struct { - fset *token.FileSet // file set [all queries] - prog *ssa.Program // the SSA program [needSSA] - ptaConfig pointer.Config // pointer analysis configuration [needPTA] - typeInfo map[*types.Package]*importer.PackageInfo // type info for all ASTs in the program [needRetainTypeInfo] + fset *token.FileSet // file set [all queries] + prog *ssa.Program // the SSA program [needSSA] + ptaConfig pointer.Config // pointer analysis configuration [needPTA] + typeInfo map[*types.Package]*loader.PackageInfo // type info for all ASTs in the program [needRetainTypeInfo] } // A set of bits indicating the analytical requirements of each mode. @@ -136,10 +136,10 @@ type queryResult interface { // type QueryPos struct { fset *token.FileSet - start, end token.Pos // source extent of query - path []ast.Node // AST path from query node to root of ast.File - exact bool // 2nd result of PathEnclosingInterval - info *importer.PackageInfo // type info for the queried package (nil for fastQueryPos) + start, end token.Pos // source extent of query + path []ast.Node // AST path from query node to root of ast.File + exact bool // 2nd result of PathEnclosingInterval + info *loader.PackageInfo // type info for the queried package (nil for fastQueryPos) } // TypeString prints type T relative to the query position. @@ -183,7 +183,7 @@ func (res *Result) Serial() *serial.Result { // Query runs a single oracle query. // -// args specify the main package in (*importer.Config).FromArgs syntax. +// args specify the main package in (*loader.Config).FromArgs syntax. // mode is the query mode ("callers", etc). // ptalog is the (optional) pointer-analysis log file. // buildContext is the go/build configuration for locating packages. @@ -192,7 +192,7 @@ func (res *Result) Serial() *serial.Result { // Clients that intend to perform multiple queries against the same // analysis scope should use this pattern instead: // -// conf := importer.Config{Build: buildContext, SourceImports: true} +// conf := loader.Config{Build: buildContext, SourceImports: true} // ... populate config, e.g. conf.FromArgs(args) ... // iprog, err := conf.Load() // if err != nil { ... } @@ -222,7 +222,7 @@ func Query(args []string, mode, pos string, ptalog io.Writer, buildContext *buil return nil, fmt.Errorf("invalid mode type: %q", mode) } - conf := importer.Config{Build: buildContext, SourceImports: true} + conf := loader.Config{Build: buildContext, SourceImports: true} // Determine initial packages. args, err := conf.FromArgs(args) @@ -280,7 +280,7 @@ func Query(args []string, mode, pos string, ptalog io.Writer, buildContext *buil // // TODO(adonovan): this is a real mess... but it's fast. // -func reduceScope(pos string, conf *importer.Config) { +func reduceScope(pos string, conf *loader.Config) { fqpos, err := fastQueryPos(pos) if err != nil { return // bad query @@ -299,7 +299,7 @@ func reduceScope(pos string, conf *importer.Config) { // Check that it's possible to load the queried package. // (e.g. oracle tests contain different 'package' decls in same dir.) - // Keep consistent with logic in importer/util.go! + // Keep consistent with logic in loader/util.go! cfg2 := *conf.Build cfg2.CgoEnabled = false bp, err := cfg2.Import(importPath, "", 0) @@ -334,11 +334,11 @@ func reduceScope(pos string, conf *importer.Config) { // ptalog is the (optional) pointer-analysis log file. // reflection determines whether to model reflection soundly (currently slow). // -func New(iprog *importer.Program, ptalog io.Writer, reflection bool) (*Oracle, error) { +func New(iprog *loader.Program, ptalog io.Writer, reflection bool) (*Oracle, error) { return newOracle(iprog, ptalog, needAll, reflection) } -func newOracle(iprog *importer.Program, ptalog io.Writer, needs int, reflection bool) (*Oracle, error) { +func newOracle(iprog *loader.Program, ptalog io.Writer, needs int, reflection bool) (*Oracle, error) { o := &Oracle{fset: iprog.Fset} // Retain type info for all ASTs in the program. @@ -421,7 +421,7 @@ func (o *Oracle) query(minfo *modeInfo, qpos *QueryPos) (*Result, error) { // this is appropriate for queries that allow fairly arbitrary syntax, // e.g. "describe". // -func ParseQueryPos(iprog *importer.Program, posFlag string, needExact bool) (*QueryPos, error) { +func ParseQueryPos(iprog *loader.Program, posFlag string, needExact bool) (*QueryPos, error) { filename, startOffset, endOffset, err := parsePosFlag(posFlag) if err != nil { return nil, err diff --git a/oracle/oracle_test.go b/oracle/oracle_test.go index 85a3ae4b2..37355646b 100644 --- a/oracle/oracle_test.go +++ b/oracle/oracle_test.go @@ -44,7 +44,7 @@ import ( "strings" "testing" - "code.google.com/p/go.tools/importer" + "code.google.com/p/go.tools/go/loader" "code.google.com/p/go.tools/oracle" ) @@ -256,10 +256,10 @@ func TestOracle(t *testing.T) { } func TestMultipleQueries(t *testing.T) { - // Importer + // Loader var buildContext = build.Default buildContext.GOPATH = "testdata" - conf := importer.Config{Build: &buildContext} + conf := loader.Config{Build: &buildContext} filename := "testdata/src/main/multi.go" conf.CreateFromFilenames(filename) iprog, err := conf.Load() diff --git a/oracle/peers.go b/oracle/peers.go index a47a00c14..fa34c9e07 100644 --- a/oracle/peers.go +++ b/oracle/peers.go @@ -10,11 +10,11 @@ import ( "go/token" "sort" + "code.google.com/p/go.tools/go/pointer" + "code.google.com/p/go.tools/go/ssa" + "code.google.com/p/go.tools/go/ssa/ssautil" "code.google.com/p/go.tools/go/types" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/pointer" - "code.google.com/p/go.tools/ssa" - "code.google.com/p/go.tools/ssa/ssautil" ) // peers enumerates, for a given channel send (or receive) operation, diff --git a/oracle/pointsto.go b/oracle/pointsto.go index 9ebaf5f52..2bcd525b1 100644 --- a/oracle/pointsto.go +++ b/oracle/pointsto.go @@ -11,11 +11,11 @@ import ( "sort" "code.google.com/p/go.tools/astutil" + "code.google.com/p/go.tools/go/loader" + "code.google.com/p/go.tools/go/pointer" + "code.google.com/p/go.tools/go/ssa" "code.google.com/p/go.tools/go/types" - "code.google.com/p/go.tools/importer" "code.google.com/p/go.tools/oracle/serial" - "code.google.com/p/go.tools/pointer" - "code.google.com/p/go.tools/ssa" ) // pointsto runs the pointer analysis on the selected expression, @@ -85,7 +85,7 @@ func pointsto(o *Oracle, qpos *QueryPos) (queryResult, error) { // to the root of the AST is path. isAddr reports whether the // ssa.Value is the address denoted by the ast.Ident, not its value. // -func ssaValueForIdent(prog *ssa.Program, qinfo *importer.PackageInfo, obj types.Object, path []ast.Node) (value ssa.Value, isAddr bool, err error) { +func ssaValueForIdent(prog *ssa.Program, qinfo *loader.PackageInfo, obj types.Object, path []ast.Node) (value ssa.Value, isAddr bool, err error) { switch obj := obj.(type) { case *types.Var: pkg := prog.Package(qinfo.Pkg) @@ -104,7 +104,7 @@ func ssaValueForIdent(prog *ssa.Program, qinfo *importer.PackageInfo, obj types. // ssaValueForExpr returns the ssa.Value of the non-ast.Ident // expression whose path to the root of the AST is path. // -func ssaValueForExpr(prog *ssa.Program, qinfo *importer.PackageInfo, path []ast.Node) (value ssa.Value, isAddr bool, err error) { +func ssaValueForExpr(prog *ssa.Program, qinfo *loader.PackageInfo, path []ast.Node) (value ssa.Value, isAddr bool, err error) { pkg := prog.Package(qinfo.Pkg) pkg.SetDebugMode(true) pkg.Build()