Skip to content

Commit 7b23775

Browse files
aykevldeadprogram
authored andcommitted
compiler: unexport some exported symbols
Some symbols (constants/types/methods) were exported while they are an implementation detail. To keep the public API clean, unexport them.
1 parent 471cb4c commit 7b23775

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

compiler/calls.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
// The maximum number of arguments that can be expanded from a single struct. If
1313
// a struct contains more fields, it is passed as a struct without expanding.
14-
const MaxFieldsPerParam = 3
14+
const maxFieldsPerParam = 3
1515

1616
// paramFlags identifies parameter attributes for flags. Most importantly, it
1717
// determines which parameters are dereferenceable_or_null and which aren't.
@@ -52,7 +52,7 @@ func expandFormalParamType(t llvm.Type, goType types.Type) ([]llvm.Type, []param
5252
switch t.TypeKind() {
5353
case llvm.StructTypeKind:
5454
fields, fieldFlags := flattenAggregateType(t, goType)
55-
if len(fields) <= MaxFieldsPerParam {
55+
if len(fields) <= maxFieldsPerParam {
5656
return fields, fieldFlags
5757
} else {
5858
// failed to lower
@@ -72,7 +72,7 @@ func (b *builder) expandFormalParamOffsets(t llvm.Type) []uint64 {
7272
switch t.TypeKind() {
7373
case llvm.StructTypeKind:
7474
fields := b.flattenAggregateTypeOffsets(t)
75-
if len(fields) <= MaxFieldsPerParam {
75+
if len(fields) <= maxFieldsPerParam {
7676
return fields
7777
} else {
7878
// failed to lower
@@ -92,7 +92,7 @@ func (b *builder) expandFormalParam(v llvm.Value) []llvm.Value {
9292
switch v.Type().TypeKind() {
9393
case llvm.StructTypeKind:
9494
fieldTypes, _ := flattenAggregateType(v.Type(), nil)
95-
if len(fieldTypes) <= MaxFieldsPerParam {
95+
if len(fieldTypes) <= maxFieldsPerParam {
9696
fields := b.flattenAggregate(v)
9797
if len(fields) != len(fieldTypes) {
9898
panic("type and value param lowering don't match")
@@ -227,7 +227,7 @@ func (b *builder) collapseFormalParamInternal(t llvm.Type, fields []llvm.Value)
227227
switch t.TypeKind() {
228228
case llvm.StructTypeKind:
229229
flattened, _ := flattenAggregateType(t, nil)
230-
if len(flattened) <= MaxFieldsPerParam {
230+
if len(flattened) <= maxFieldsPerParam {
231231
value := llvm.ConstNull(t)
232232
for i, subtyp := range t.StructElementTypes() {
233233
structField, remaining := b.collapseFormalParamInternal(subtyp, fields)

compiler/compiler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ type builder struct {
6565
blockEntries map[*ssa.BasicBlock]llvm.BasicBlock // a *ssa.BasicBlock may be split up
6666
blockExits map[*ssa.BasicBlock]llvm.BasicBlock // these are the exit blocks
6767
currentBlock *ssa.BasicBlock
68-
phis []Phi
68+
phis []phiNode
6969
taskHandle llvm.Value
7070
deferPtr llvm.Value
7171
difunc llvm.Metadata
@@ -77,7 +77,7 @@ type builder struct {
7777
selectRecvBuf map[*ssa.Select]llvm.Value
7878
}
7979

80-
type Phi struct {
80+
type phiNode struct {
8181
ssa *ssa.Phi
8282
llvm llvm.Value
8383
}
@@ -196,7 +196,7 @@ func Compile(pkgName string, machine llvm.TargetMachine, config *compileopts.Con
196196
return ""
197197
},
198198
TypeChecker: types.Config{
199-
Sizes: &StdSizes{
199+
Sizes: &stdSizes{
200200
IntSize: int64(c.targetData.TypeAllocSize(c.intType)),
201201
PtrSize: int64(c.targetData.PointerSize()),
202202
MaxAlign: int64(c.targetData.PrefTypeAlignment(c.i8ptrType)),
@@ -1740,7 +1740,7 @@ func (b *builder) createExpr(expr ssa.Value) (llvm.Value, error) {
17401740
}
17411741
case *ssa.Phi:
17421742
phi := b.CreatePHI(b.getLLVMType(expr.Type()), "")
1743-
b.phis = append(b.phis, Phi{expr, phi})
1743+
b.phis = append(b.phis, phiNode{expr, phi})
17441744
return phi, nil
17451745
case *ssa.Range:
17461746
var iteratorType llvm.Type

compiler/sizes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
// The original license can be found here:
1111
// https://golang.org/LICENSE
1212

13-
type StdSizes struct {
13+
type stdSizes struct {
1414
IntSize int64
1515
PtrSize int64
1616
MaxAlign int64
1717
}
1818

19-
func (s *StdSizes) Alignof(T types.Type) int64 {
19+
func (s *stdSizes) Alignof(T types.Type) int64 {
2020
// For arrays and structs, alignment is defined in terms
2121
// of alignment of the elements and fields, respectively.
2222
switch t := T.Underlying().(type) {
@@ -61,7 +61,7 @@ func (s *StdSizes) Alignof(T types.Type) int64 {
6161
return a
6262
}
6363

64-
func (s *StdSizes) Offsetsof(fields []*types.Var) []int64 {
64+
func (s *stdSizes) Offsetsof(fields []*types.Var) []int64 {
6565
offsets := make([]int64, len(fields))
6666
var o int64
6767
for i, f := range fields {
@@ -89,7 +89,7 @@ var basicSizes = [...]byte{
8989
types.Complex128: 16,
9090
}
9191

92-
func (s *StdSizes) Sizeof(T types.Type) int64 {
92+
func (s *stdSizes) Sizeof(T types.Type) int64 {
9393
switch t := T.Underlying().(type) {
9494
case *types.Basic:
9595
k := t.Kind()

0 commit comments

Comments
 (0)