diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2019-01-18 16:45:30 +0100 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2019-01-24 02:11:08 +0100 |
commit | ce354a6afbf1813c9a5565a00f6937c1b6fd1e42 (patch) | |
tree | 5f8fef7e2879a8aec6e8c22302c4fce5e46e7083 /vendor/golang.org/x/tools/go/ssa/ssautil/visit.go | |
parent | 56dd0f4dfdc33594502ec02421425c3432570be3 (diff) |
[pkg] remove vendoring of golang/x/*
I think there's no need of vendoring this.
The debian package builds fine without them - at least with the text-dev
package in testing.
Diffstat (limited to 'vendor/golang.org/x/tools/go/ssa/ssautil/visit.go')
-rw-r--r-- | vendor/golang.org/x/tools/go/ssa/ssautil/visit.go | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/vendor/golang.org/x/tools/go/ssa/ssautil/visit.go b/vendor/golang.org/x/tools/go/ssa/ssautil/visit.go deleted file mode 100644 index 3424e8a..0000000 --- a/vendor/golang.org/x/tools/go/ssa/ssautil/visit.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ssautil // import "golang.org/x/tools/go/ssa/ssautil" - -import "golang.org/x/tools/go/ssa" - -// This file defines utilities for visiting the SSA representation of -// a Program. -// -// TODO(adonovan): test coverage. - -// AllFunctions finds and returns the set of functions potentially -// needed by program prog, as determined by a simple linker-style -// reachability algorithm starting from the members and method-sets of -// each package. The result may include anonymous functions and -// synthetic wrappers. -// -// Precondition: all packages are built. -// -func AllFunctions(prog *ssa.Program) map[*ssa.Function]bool { - visit := visitor{ - prog: prog, - seen: make(map[*ssa.Function]bool), - } - visit.program() - return visit.seen -} - -type visitor struct { - prog *ssa.Program - seen map[*ssa.Function]bool -} - -func (visit *visitor) program() { - for _, pkg := range visit.prog.AllPackages() { - for _, mem := range pkg.Members { - if fn, ok := mem.(*ssa.Function); ok { - visit.function(fn) - } - } - } - for _, T := range visit.prog.RuntimeTypes() { - mset := visit.prog.MethodSets.MethodSet(T) - for i, n := 0, mset.Len(); i < n; i++ { - visit.function(visit.prog.MethodValue(mset.At(i))) - } - } -} - -func (visit *visitor) function(fn *ssa.Function) { - if !visit.seen[fn] { - visit.seen[fn] = true - var buf [10]*ssa.Value // avoid alloc in common case - for _, b := range fn.Blocks { - for _, instr := range b.Instrs { - for _, op := range instr.Operands(buf[:0]) { - if fn, ok := (*op).(*ssa.Function); ok { - visit.function(fn) - } - } - } - } - } -} - -// MainPackages returns the subset of the specified packages -// named "main" that define a main function. -// The result may include synthetic "testmain" packages. -func MainPackages(pkgs []*ssa.Package) []*ssa.Package { - var mains []*ssa.Package - for _, pkg := range pkgs { - if pkg.Pkg.Name() == "main" && pkg.Func("main") != nil { - mains = append(mains, pkg) - } - } - return mains -} |