mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: reduce garbage from autolabel
Follow-up to CL 26661 Change-Id: I67c58d17313094675cf0f30ce50d486818ae0dcb Reviewed-on: https://go-review.googlesource.com/27113 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
77e68ea78a
commit
fe27291c00
3 changed files with 10 additions and 5 deletions
|
|
@ -248,16 +248,21 @@ func LookupN(prefix string, n int) *Sym {
|
|||
|
||||
// autolabel generates a new Name node for use with
|
||||
// an automatically generated label.
|
||||
// prefix is a short mnemonic (e.g. "s" for switch)
|
||||
// prefix is a short mnemonic (e.g. ".s" for switch)
|
||||
// to help with debugging.
|
||||
// It should begin with "." to avoid conflicts with
|
||||
// user labels.
|
||||
func autolabel(prefix string) *Node {
|
||||
if prefix[0] != '.' {
|
||||
Fatalf("autolabel prefix must start with '.', have %q", prefix)
|
||||
}
|
||||
fn := Curfn
|
||||
if Curfn == nil {
|
||||
Fatalf("autolabel outside function")
|
||||
}
|
||||
n := fn.Func.Label
|
||||
fn.Func.Label++
|
||||
return newname(LookupN("."+prefix, int(n)))
|
||||
return newname(LookupN(prefix, int(n)))
|
||||
}
|
||||
|
||||
var initSyms []*Sym
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue