mirror of
https://github.com/golang/go
synced 2024-11-12 10:00:25 -07:00
cmd/compile/internal/gc: various minor cleanups
Two funcs and a field were unused. Remove them. A few statements could be made simpler. importsym's pos parameter was unused, so remove it. Finally, don't use printf-like funcs with constant strings that have no formatting directives. Change-Id: I415452249bf2168aa353ac4f3643dfc03017ee53 Reviewed-on: https://go-review.googlesource.com/117699 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
9e4d87d115
commit
3b7b9dce43
@ -227,17 +227,6 @@ type bvecSet struct {
|
|||||||
uniq []bvec // unique bvecs, in insertion order
|
uniq []bvec // unique bvecs, in insertion order
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBvecSet(size int) bvecSet {
|
|
||||||
// bvecSet is a linear probing hash table.
|
|
||||||
// The hash table has 4n entries to keep the linear
|
|
||||||
// scan short.
|
|
||||||
index := make([]int, size*4)
|
|
||||||
for i := range index {
|
|
||||||
index[i] = -1
|
|
||||||
}
|
|
||||||
return bvecSet{index, nil}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *bvecSet) grow() {
|
func (m *bvecSet) grow() {
|
||||||
// Allocate new index.
|
// Allocate new index.
|
||||||
n := len(m.index) * 2
|
n := len(m.index) * 2
|
||||||
|
@ -766,7 +766,7 @@ func evconst(n *Node) {
|
|||||||
v.U.(*Mpint).Neg()
|
v.U.(*Mpint).Neg()
|
||||||
|
|
||||||
case OCOM_ | CTINT_:
|
case OCOM_ | CTINT_:
|
||||||
var et types.EType = Txxx
|
et := Txxx
|
||||||
if nl.Type != nil {
|
if nl.Type != nil {
|
||||||
et = nl.Type.Etype
|
et = nl.Type.Etype
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func assembleInlines(fnsym *obj.LSym, dwVars []*dwarf.Var) dwarf.InlCalls {
|
|||||||
// return temps (~r%d) that were created during
|
// return temps (~r%d) that were created during
|
||||||
// lowering, or unnamed params ("_").
|
// lowering, or unnamed params ("_").
|
||||||
v.ChildIndex = int32(synthCount)
|
v.ChildIndex = int32(synthCount)
|
||||||
synthCount += 1
|
synthCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ func dumpexport(bout *bio.Writer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func importsym(ipkg *types.Pkg, pos src.XPos, s *types.Sym, op Op) *Node {
|
func importsym(ipkg *types.Pkg, s *types.Sym, op Op) *Node {
|
||||||
n := asNode(s.PkgDef())
|
n := asNode(s.PkgDef())
|
||||||
if n == nil {
|
if n == nil {
|
||||||
// iimport should have created a stub ONONAME
|
// iimport should have created a stub ONONAME
|
||||||
@ -113,7 +113,7 @@ func importsym(ipkg *types.Pkg, pos src.XPos, s *types.Sym, op Op) *Node {
|
|||||||
// If no such type has been declared yet, a forward declaration is returned.
|
// If no such type has been declared yet, a forward declaration is returned.
|
||||||
// ipkg is the package being imported
|
// ipkg is the package being imported
|
||||||
func importtype(ipkg *types.Pkg, pos src.XPos, s *types.Sym) *types.Type {
|
func importtype(ipkg *types.Pkg, pos src.XPos, s *types.Sym) *types.Type {
|
||||||
n := importsym(ipkg, pos, s, OTYPE)
|
n := importsym(ipkg, s, OTYPE)
|
||||||
if n.Op != OTYPE {
|
if n.Op != OTYPE {
|
||||||
t := types.New(TFORW)
|
t := types.New(TFORW)
|
||||||
t.Sym = s
|
t.Sym = s
|
||||||
@ -135,7 +135,7 @@ func importtype(ipkg *types.Pkg, pos src.XPos, s *types.Sym) *types.Type {
|
|||||||
// importobj declares symbol s as an imported object representable by op.
|
// importobj declares symbol s as an imported object representable by op.
|
||||||
// ipkg is the package being imported
|
// ipkg is the package being imported
|
||||||
func importobj(ipkg *types.Pkg, pos src.XPos, s *types.Sym, op Op, ctxt Class, t *types.Type) *Node {
|
func importobj(ipkg *types.Pkg, pos src.XPos, s *types.Sym, op Op, ctxt Class, t *types.Type) *Node {
|
||||||
n := importsym(ipkg, pos, s, op)
|
n := importsym(ipkg, s, op)
|
||||||
if n.Op != ONONAME {
|
if n.Op != ONONAME {
|
||||||
if n.Op == op && (n.Class() != ctxt || !eqtype(n.Type, t)) {
|
if n.Op == op && (n.Class() != ctxt || !eqtype(n.Type, t)) {
|
||||||
redeclare(lineno, s, fmt.Sprintf("during import %q", ipkg.Path))
|
redeclare(lineno, s, fmt.Sprintf("during import %q", ipkg.Path))
|
||||||
|
@ -595,7 +595,7 @@ func (p *iexporter) typOff(t *types.Type) uint64 {
|
|||||||
if !ok {
|
if !ok {
|
||||||
w := p.newWriter()
|
w := p.newWriter()
|
||||||
w.doTyp(t)
|
w.doTyp(t)
|
||||||
off = predeclReserved + uint64(w.flush())
|
off = predeclReserved + w.flush()
|
||||||
p.typIndex[t] = off
|
p.typIndex[t] = off
|
||||||
}
|
}
|
||||||
return off
|
return off
|
||||||
|
@ -341,7 +341,7 @@ func Main(archInit func(*Arch)) {
|
|||||||
}
|
}
|
||||||
// display help about the -d option itself and quit
|
// display help about the -d option itself and quit
|
||||||
if name == "help" {
|
if name == "help" {
|
||||||
fmt.Printf(debugHelpHeader)
|
fmt.Print(debugHelpHeader)
|
||||||
maxLen := len("ssa/help")
|
maxLen := len("ssa/help")
|
||||||
for _, t := range debugtab {
|
for _, t := range debugtab {
|
||||||
if len(t.name) > maxLen {
|
if len(t.name) > maxLen {
|
||||||
@ -353,7 +353,7 @@ func Main(archInit func(*Arch)) {
|
|||||||
}
|
}
|
||||||
// ssa options have their own help
|
// ssa options have their own help
|
||||||
fmt.Printf("\t%-*s\t%s\n", maxLen, "ssa/help", "print help about SSA debugging")
|
fmt.Printf("\t%-*s\t%s\n", maxLen, "ssa/help", "print help about SSA debugging")
|
||||||
fmt.Printf(debugHelpFooter)
|
fmt.Print(debugHelpFooter)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
val, valstring, haveInt := 1, "", true
|
val, valstring, haveInt := 1, "", true
|
||||||
|
@ -299,8 +299,8 @@ func (a *Mpint) SetString(as string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Mpint) String() string {
|
func (a *Mpint) String() string {
|
||||||
return bconv(x, 0)
|
return bconv(a, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func bconv(xval *Mpint, flag FmtFlag) string {
|
func bconv(xval *Mpint, flag FmtFlag) string {
|
||||||
|
@ -350,7 +350,6 @@ type scopexplainContext struct {
|
|||||||
dwarfData *dwarf.Data
|
dwarfData *dwarf.Data
|
||||||
dwarfReader *dwarf.Reader
|
dwarfReader *dwarf.Reader
|
||||||
scopegen int
|
scopegen int
|
||||||
lines map[line][]int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// readScope reads the DW_TAG_lexical_block or the DW_TAG_subprogram in
|
// readScope reads the DW_TAG_lexical_block or the DW_TAG_subprogram in
|
||||||
|
@ -2220,14 +2220,6 @@ func callnew(t *types.Type) *Node {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func iscallret(n *Node) bool {
|
|
||||||
if n == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
n = outervalue(n)
|
|
||||||
return n.Op == OINDREGSP
|
|
||||||
}
|
|
||||||
|
|
||||||
// isReflectHeaderDataField reports whether l is an expression p.Data
|
// isReflectHeaderDataField reports whether l is an expression p.Data
|
||||||
// where p has type reflect.SliceHeader or reflect.StringHeader.
|
// where p has type reflect.SliceHeader or reflect.StringHeader.
|
||||||
func isReflectHeaderDataField(l *Node) bool {
|
func isReflectHeaderDataField(l *Node) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user