]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: add explicit file name in types generation
authorMeng Zhuo <mzh@golangcn.org>
Mon, 28 Dec 2020 07:22:47 +0000 (15:22 +0800)
committerMeng Zhuo <mzh@golangcn.org>
Mon, 28 Dec 2020 07:45:19 +0000 (07:45 +0000)
The stringer using `go list` for the type detection, which depends on
GOROOT. Unfortunally by changing GOROOT to develop path will raise
version mismatch with internal packages.

Update #43369

Change-Id: Id81334ea5f1ecdbfa81eb2d162944d65664ce727
Reviewed-on: https://go-review.googlesource.com/c/go/+/280572
Trust: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/compile/internal/types/alg.go
src/cmd/compile/internal/types/algkind_string.go
src/cmd/compile/internal/types/goversion.go
src/cmd/compile/internal/types/kind_string.go [moved from src/cmd/compile/internal/types/etype_string.go with 59% similarity]
src/cmd/compile/internal/types/type.go

index 14200e0d162a4e493fc089ae2729f252b71ae5ff..f1a472cca58a0f16fc40c9b46a9bc9d925b15d0b 100644 (file)
@@ -10,7 +10,7 @@ import "cmd/compile/internal/base"
 // hashing a Type.
 type AlgKind int
 
-//go:generate stringer -type AlgKind -trimprefix A
+//go:generate stringer -type AlgKind -trimprefix A alg.go
 
 const (
        // These values are known by runtime.
index 8c5a0bc287ee5e6b2d21454b6f41f402ff2bc179..a1b518e4dde260d08c5fa36aeeb72c599ed5e7e5 100644 (file)
@@ -1,4 +1,4 @@
-// Code generated by "stringer -type AlgKind -trimprefix A"; DO NOT EDIT.
+// Code generated by "stringer -type AlgKind -trimprefix A alg.go"; DO NOT EDIT.
 
 package types
 
index 2265f472cf67329903822ca0824fa0d35c0d3737..1a324aa42fdb70de258ce6abfbc12dabf2505bca 100644 (file)
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:generate go run mkbuiltin.go
-
 package types
 
 import (
similarity index 59%
rename from src/cmd/compile/internal/types/etype_string.go
rename to src/cmd/compile/internal/types/kind_string.go
index e7698296abf26d6042fa1a24cc0b0678bf461a38..1e1e84624080b08e614821c3e936c5c58daa4f01 100644 (file)
@@ -1,4 +1,4 @@
-// Code generated by "stringer -type EType -trimprefix T"; DO NOT EDIT.
+// Code generated by "stringer -type Kind -trimprefix T type.go"; DO NOT EDIT.
 
 package types
 
@@ -48,13 +48,13 @@ func _() {
        _ = x[NTYPE-37]
 }
 
-const _EType_name = "xxxINT8UINT8INT16UINT16INT32UINT32INT64UINT64INTUINTUINTPTRCOMPLEX64COMPLEX128FLOAT32FLOAT64BOOLPTRFUNCSLICEARRAYSTRUCTCHANMAPINTERFORWANYSTRINGUNSAFEPTRIDEALNILBLANKFUNCARGSCHANARGSSSATUPLERESULTSNTYPE"
+const _Kind_name = "xxxINT8UINT8INT16UINT16INT32UINT32INT64UINT64INTUINTUINTPTRCOMPLEX64COMPLEX128FLOAT32FLOAT64BOOLPTRFUNCSLICEARRAYSTRUCTCHANMAPINTERFORWANYSTRINGUNSAFEPTRIDEALNILBLANKFUNCARGSCHANARGSSSATUPLERESULTSNTYPE"
 
-var _EType_index = [...]uint8{0, 3, 7, 12, 17, 23, 28, 34, 39, 45, 48, 52, 59, 68, 78, 85, 92, 96, 99, 103, 108, 113, 119, 123, 126, 131, 135, 138, 144, 153, 158, 161, 166, 174, 182, 185, 190, 197, 202}
+var _Kind_index = [...]uint8{0, 3, 7, 12, 17, 23, 28, 34, 39, 45, 48, 52, 59, 68, 78, 85, 92, 96, 99, 103, 108, 113, 119, 123, 126, 131, 135, 138, 144, 153, 158, 161, 166, 174, 182, 185, 190, 197, 202}
 
 func (i Kind) String() string {
-       if i >= Kind(len(_EType_index)-1) {
-               return "EType(" + strconv.FormatInt(int64(i), 10) + ")"
+       if i >= Kind(len(_Kind_index)-1) {
+               return "Kind(" + strconv.FormatInt(int64(i), 10) + ")"
        }
-       return _EType_name[_EType_index[i]:_EType_index[i+1]]
+       return _Kind_name[_Kind_index[i]:_Kind_index[i+1]]
 }
index b5557b492eb7aabcf6c55dc8c75dd4146ae4e150..6feedbfabc5a726481dea293f96475e3fd3e2c12 100644 (file)
@@ -33,9 +33,9 @@ type VarObject interface {
        RecordFrameOffset(int64) // save frame offset
 }
 
-//go:generate stringer -type EType -trimprefix T
+//go:generate stringer -type Kind -trimprefix T type.go
 
-// EType describes a kind of type.
+// Kind describes a kind of type.
 type Kind uint8
 
 const (