func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isResult, setNname bool) {
if f.Offset != types.BADWIDTH {
- base.Fatalf("field offset for %s at %s has been set to %d", f.Sym.Name, base.FmtPos(f.Pos), f.Offset)
+ base.Fatalf("field offset for %s at %s has been set to %d", f.Sym, base.FmtPos(f.Pos), f.Offset)
}
// Everything except return values in registers has either a frame home (if not in a register) or a frame spill location.
func (b *batch) paramTag(fn *ir.Func, narg int, f *types.Field) string {
name := func() string {
- if f.Sym != nil {
- return f.Sym.Name
+ if f.Nname != nil {
+ return f.Nname.Sym().Name
}
return fmt.Sprintf("arg#%d", narg)
}
}
for i := 0; i < numEscResults; i++ {
if x := esc.Result(i); x >= 0 {
- res := sig.Result(i).Sym
+ res := sig.Result(i).Nname.Sym().Name
base.WarnfAt(pos, "leaking param: %v to result %v level=%d", name, res, x)
warned = true
}
// temporaries for return values.
for _, param := range fn.Type().Results() {
- if sym := types.OrigSym(param.Sym); sym != nil && !sym.IsBlank() {
+ if sym := param.Sym; sym != nil && !sym.IsBlank() {
return false // found a named result parameter (case 3)
}
}
}
for i, param := range sig.Results() {
- sym := types.OrigSym(param.Sym)
+ sym := param.Sym
if sym == nil || sym.IsBlank() {
prefix := "~r"
if r.inlCall == nil {
if !r.funarghack {
- param.Sym = sym
param.Nname = name
}
} else {
"encoding/binary"
"fmt"
"strconv"
- "strings"
"sync"
"cmd/compile/internal/base"
// BlankSym is the blank (_) symbol.
var BlankSym *Sym
-// OrigSym returns the original symbol written by the user.
-func OrigSym(s *Sym) *Sym {
- if s == nil {
- return nil
- }
-
- if len(s.Name) > 1 && s.Name[0] == '~' {
- switch s.Name[1] {
- case 'r': // originally an unnamed result
- return nil
- case 'b': // originally the blank identifier _
- // TODO(mdempsky): Does s.Pkg matter here?
- return BlankSym
- }
- return s
- }
-
- if strings.HasPrefix(s.Name, ".anon") {
- // originally an unnamed or _ name (see subr.go: NewFuncParams)
- return nil
- }
-
- return s
-}
-
// numImport tracks how often a package with a given name is imported.
// It is used to provide a better error message (by using the package
// path to disambiguate) if a package that appears multiple times with
if verb != 'S' {
s := f.Sym
- // Take the name from the original.
- if mode == fmtGo {
- s = OrigSym(s)
- }
-
// Using type aliases and embedded fields, it's possible to
// construct types that can't be directly represented as a
// type literal. For example, given "type Int = int" (#50190),
continue
}
- if sym := types.OrigSym(name.Sym()); sym == nil || sym.IsBlank() {
+ if ir.IsBlank(name) {
// We can ignore assignments to blank or anonymous result parameters.
// These can't appear in expressions anyway.
continue