Skip to content

Commit 23b8806

Browse files
committed
all: run goimports using Go 1.19 release (for new doc comments syntax)
ref: https://go.dev/blog/go1.19 ref: https://go.dev/doc/go1.19 ref: https://go.dev/doc/comment
1 parent 9ac0a22 commit 23b8806

26 files changed

+383
-347
lines changed

asm/global.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ func (gen *generator) irFuncHeader(new *ir.Func, old ast.FuncHeader) error {
620620

621621
// gepExprType computes the result type of a getelementptr constant expression.
622622
//
623-
// getelementptr ElemType, Src, Indices
623+
// getelementptr ElemType, Src, Indices
624624
//
625625
// Notably, gepExprType returns the type of the gep expression without resolving
626626
// the underlying src value. As such gepExprType may be invoked before

asm/inst_memory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ func (fgen *funcGen) irGetElementPtrInst(new ir.Instruction, old *ast.GetElement
367367

368368
// gepInstType computes the result type of a getelementptr instruction.
369369
//
370-
// getelementptr ElemType, Src, Indices
370+
// getelementptr ElemType, Src, Indices
371371
func (gen *generator) gepInstType(elemType, src types.Type, indices []ast.TypeValue) (types.Type, error) {
372372
var idxs []gep.Index
373373
for _, index := range indices {

asm/type.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ func (gen *generator) createTypeDefs() error {
5656
//
5757
// For instance, the following is disallowed.
5858
//
59-
// ; self-referential named type.
60-
// %a = type %a
59+
// ; self-referential named type.
60+
// %a = type %a
6161
//
62-
// ; recursively self-referential named types.
63-
// %b = type %c
64-
// %c = type %b
62+
// ; recursively self-referential named types.
63+
// %b = type %c
64+
// %c = type %b
6565
//
6666
// The following is allowed, however.
6767
//
68-
// ; struct type containing pointer to itself.
69-
// %d = type { %d* }
68+
// ; struct type containing pointer to itself.
69+
// %d = type { %d* }
7070
func newType(typeName string, old ast.LlvmNode, index map[string]*ast.TypeDef, track map[string]bool) (types.Type, error) {
7171
switch old := old.(type) {
7272
case *ast.VoidType:

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ require (
99
github.com/llir/ll v0.0.0-20220802205332-9207a04d0275
1010
github.com/mewmew/float v0.0.0-20201204173432-505706aa38fa
1111
github.com/pkg/errors v0.9.1
12-
golang.org/x/tools v0.1.4
12+
golang.org/x/tools v0.1.12
1313
)

go.sum

+15-4
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,40 @@ github.com/mewmew/float v0.0.0-20201204173432-505706aa38fa/go.mod h1:O+xb+8ycBNH
1414
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
1515
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1616
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
17+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
1718
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1819
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
19-
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
20+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
2021
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
22+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
23+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
2124
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2225
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
26+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
2327
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
28+
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
2429
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
2530
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
31+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
2632
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2733
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2834
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2935
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
30-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
3136
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
37+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
38+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
39+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
40+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3241
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
42+
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
3343
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
3444
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
45+
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
3546
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
3647
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
37-
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
3848
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
49+
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
50+
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
3951
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
4052
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
41-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
4253
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/enc/enc.go

+60-38
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
// GlobalName encodes a global name to its LLVM IR assembly representation.
1111
//
1212
// Examples:
13-
// "foo" -> "@foo"
14-
// "a b" -> `@"a b"`
15-
// "世" -> `@"\E4\B8\96"`
16-
// "2" -> `@"2"`
13+
//
14+
// "foo" -> "@foo"
15+
// "a b" -> `@"a b"`
16+
// "世" -> `@"\E4\B8\96"`
17+
// "2" -> `@"2"`
1718
//
1819
// References:
19-
// http://www.llvm.org/docs/LangRef.html#identifiers
20+
//
21+
// http://www.llvm.org/docs/LangRef.html#identifiers
2022
func GlobalName(name string) string {
2123
// Positive numeric global names are quoted to distinguish global names from
2224
// global IDs; e.g.
@@ -31,10 +33,12 @@ func GlobalName(name string) string {
3133
// GlobalID encodes a global ID to its LLVM IR assembly representation.
3234
//
3335
// Examples:
34-
// "42" -> "@42"
36+
//
37+
// "42" -> "@42"
3538
//
3639
// References:
37-
// http://www.llvm.org/docs/LangRef.html#identifiers
40+
//
41+
// http://www.llvm.org/docs/LangRef.html#identifiers
3842
func GlobalID(id int64) string {
3943
if id < 0 {
4044
panic(fmt.Errorf("negative global ID (%d); should be represented as global name", id))
@@ -45,13 +49,15 @@ func GlobalID(id int64) string {
4549
// LocalName encodes a local name to its LLVM IR assembly representation.
4650
//
4751
// Examples:
48-
// "foo" -> "%foo"
49-
// "a b" -> `%"a b"`
50-
// "世" -> `%"\E4\B8\96"`
51-
// "2" -> `%"2"`
52+
//
53+
// "foo" -> "%foo"
54+
// "a b" -> `%"a b"`
55+
// "世" -> `%"\E4\B8\96"`
56+
// "2" -> `%"2"`
5257
//
5358
// References:
54-
// http://www.llvm.org/docs/LangRef.html#identifiers
59+
//
60+
// http://www.llvm.org/docs/LangRef.html#identifiers
5561
func LocalName(name string) string {
5662
// Positive numeric local names are quoted to distinguish local names from
5763
// local IDs; e.g.
@@ -66,10 +72,12 @@ func LocalName(name string) string {
6672
// LocalID encodes a local ID to its LLVM IR assembly representation.
6773
//
6874
// Examples:
69-
// "42" -> "%42"
75+
//
76+
// "42" -> "%42"
7077
//
7178
// References:
72-
// http://www.llvm.org/docs/LangRef.html#identifiers
79+
//
80+
// http://www.llvm.org/docs/LangRef.html#identifiers
7381
func LocalID(id int64) string {
7482
if id < 0 {
7583
panic(fmt.Errorf("negative local ID (%d); should be represented as local name", id))
@@ -80,13 +88,15 @@ func LocalID(id int64) string {
8088
// LabelName encodes a label name to its LLVM IR assembly representation.
8189
//
8290
// Examples:
83-
// "foo" -> "foo:"
84-
// "a b" -> `"a b":`
85-
// "世" -> `"\E4\B8\96":`
86-
// "2" -> `"2":`
91+
//
92+
// "foo" -> "foo:"
93+
// "a b" -> `"a b":`
94+
// "世" -> `"\E4\B8\96":`
95+
// "2" -> `"2":`
8796
//
8897
// References:
89-
// http://www.llvm.org/docs/LangRef.html#identifiers
98+
//
99+
// http://www.llvm.org/docs/LangRef.html#identifiers
90100
func LabelName(name string) string {
91101
// Positive numeric label names are quoted to distinguish label names from
92102
// label IDs; e.g.
@@ -101,10 +111,12 @@ func LabelName(name string) string {
101111
// LabelID encodes a label ID to its LLVM IR assembly representation.
102112
//
103113
// Examples:
104-
// "42" -> 42:
114+
//
115+
// "42" -> 42:
105116
//
106117
// References:
107-
// http://www.llvm.org/docs/LangRef.html#identifiers
118+
//
119+
// http://www.llvm.org/docs/LangRef.html#identifiers
108120
func LabelID(id int64) string {
109121
if id < 0 {
110122
panic(fmt.Errorf("negative label ID (%d); should be represented as label name", id))
@@ -115,13 +127,15 @@ func LabelID(id int64) string {
115127
// TypeName encodes a type name to its LLVM IR assembly representation.
116128
//
117129
// Examples:
118-
// "foo" -> "%foo"
119-
// "a b" -> `%"a b"`
120-
// "世" -> `%"\E4\B8\96"`
121-
// "2" -> `%2`
130+
//
131+
// "foo" -> "%foo"
132+
// "a b" -> `%"a b"`
133+
// "世" -> `%"\E4\B8\96"`
134+
// "2" -> `%2`
122135
//
123136
// References:
124-
// http://www.llvm.org/docs/LangRef.html#identifiers
137+
//
138+
// http://www.llvm.org/docs/LangRef.html#identifiers
125139
func TypeName(name string) string {
126140
return "%" + EscapeIdent(name)
127141
}
@@ -130,36 +144,42 @@ func TypeName(name string) string {
130144
// representation.
131145
//
132146
// Examples:
133-
// "42" -> "#42"
147+
//
148+
// "42" -> "#42"
134149
//
135150
// References:
136-
// http://www.llvm.org/docs/LangRef.html#identifiers
151+
//
152+
// http://www.llvm.org/docs/LangRef.html#identifiers
137153
func AttrGroupID(id int64) string {
138154
return "#" + strconv.FormatInt(id, 10)
139155
}
140156

141157
// ComdatName encodes a comdat name to its LLVM IR assembly representation.
142158
//
143159
// Examples:
144-
// "foo" -> $%foo"
145-
// "a b" -> `$"a b"`
146-
// "世" -> `$"\E4\B8\96"`
160+
//
161+
// "foo" -> $%foo"
162+
// "a b" -> `$"a b"`
163+
// "世" -> `$"\E4\B8\96"`
147164
//
148165
// References:
149-
// http://www.llvm.org/docs/LangRef.html#identifiers
166+
//
167+
// http://www.llvm.org/docs/LangRef.html#identifiers
150168
func ComdatName(name string) string {
151169
return "$" + EscapeIdent(name)
152170
}
153171

154172
// MetadataName encodes a metadata name to its LLVM IR assembly representation.
155173
//
156174
// Examples:
157-
// "foo" -> "!foo"
158-
// "a b" -> `!a\20b`
159-
// "世" -> `!\E4\B8\96`
175+
//
176+
// "foo" -> "!foo"
177+
// "a b" -> `!a\20b`
178+
// "世" -> `!\E4\B8\96`
160179
//
161180
// References:
162-
// http://www.llvm.org/docs/LangRef.html#identifiers
181+
//
182+
// http://www.llvm.org/docs/LangRef.html#identifiers
163183
func MetadataName(name string) string {
164184
valid := func(b byte) bool {
165185
return strings.IndexByte(tail, b) != -1
@@ -175,10 +195,12 @@ func MetadataName(name string) string {
175195
// MetadataID encodes a metadata ID to its LLVM IR assembly representation.
176196
//
177197
// Examples:
178-
// "42" -> "!42"
198+
//
199+
// "42" -> "!42"
179200
//
180201
// References:
181-
// http://www.llvm.org/docs/LangRef.html#identifiers
202+
//
203+
// http://www.llvm.org/docs/LangRef.html#identifiers
182204
func MetadataID(id int64) string {
183205
return "!" + strconv.FormatInt(id, 10)
184206
}

internal/gep/gep.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewIndex(val int64) Index {
3737
// ResultType computes the result type of a getelementptr instruction or
3838
// constant expression.
3939
//
40-
// getelementptr (ElemType, Src, Indices)
40+
// getelementptr (ElemType, Src, Indices)
4141
func ResultType(elemType, src types.Type, indices []Index) types.Type {
4242
// ref: http://llvm.org/docs/GetElementPtr.html#what-effect-do-address-spaces-have-on-geps
4343
//

internal/natsort/natsort.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// embedded in strings are compared by value.
33
//
44
// References:
5-
// https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
5+
//
6+
// https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
67
package natsort
78

89
import (

ir/constant/const_float.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ func NewFloat(typ *types.FloatType, x float64) *Float {
4949
//
5050
// The floating-point string may be expressed in one of the following forms.
5151
//
52-
// * fraction floating-point literal
53-
// [+-]? [0-9]+ [.] [0-9]*
54-
// * scientific notation floating-point literal
55-
// [+-]? [0-9]+ [.] [0-9]* [eE] [+-]? [0-9]+
56-
// * hexadecimal floating-point literal
57-
// 0x[0-9A-Fa-f]{16} // HexFP
58-
// 0xK[0-9A-Fa-f]{20} // HexFP80
59-
// 0xL[0-9A-Fa-f]{32} // HexFP128
60-
// 0xM[0-9A-Fa-f]{32} // HexPPC128
61-
// 0xH[0-9A-Fa-f]{4} // HexHalf
52+
// - fraction floating-point literal
53+
// [+-]? [0-9]+ [.] [0-9]*
54+
// - scientific notation floating-point literal
55+
// [+-]? [0-9]+ [.] [0-9]* [eE] [+-]? [0-9]+
56+
// - hexadecimal floating-point literal
57+
// 0x[0-9A-Fa-f]{16} // HexFP
58+
// 0xK[0-9A-Fa-f]{20} // HexFP80
59+
// 0xL[0-9A-Fa-f]{32} // HexFP128
60+
// 0xM[0-9A-Fa-f]{32} // HexPPC128
61+
// 0xH[0-9A-Fa-f]{4} // HexHalf
6262
func NewFloatFromString(typ *types.FloatType, s string) (*Float, error) {
6363
// Hexadecimal floating-point literal.
6464
if strings.HasPrefix(s, "0x") {

0 commit comments

Comments
 (0)