ssa: debug info of chan
This commit is contained in:
@@ -35,8 +35,8 @@ type StructWithAllTypeFields struct {
|
|||||||
pi *int
|
pi *int
|
||||||
intr Interface
|
intr Interface
|
||||||
m map[string]uint64
|
m map[string]uint64
|
||||||
// c chan int
|
c chan int
|
||||||
err error
|
err error
|
||||||
// fn func(string) (int, error)
|
// fn func(string) (int, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ func FuncWithAllTypeParams(
|
|||||||
pi *int,
|
pi *int,
|
||||||
intr Interface,
|
intr Interface,
|
||||||
m map[string]uint64,
|
m map[string]uint64,
|
||||||
// c chan int,
|
c chan int,
|
||||||
err error,
|
err error,
|
||||||
// fn func(string) (int, error),
|
// fn func(string) (int, error),
|
||||||
) (int, error) {
|
) (int, error) {
|
||||||
@@ -94,7 +94,7 @@ func FuncWithAllTypeParams(
|
|||||||
s,
|
s,
|
||||||
&e,
|
&e,
|
||||||
&f, pf, pi, intr, m,
|
&f, pf, pi, intr, m,
|
||||||
// c,
|
c,
|
||||||
err,
|
err,
|
||||||
// fn,
|
// fn,
|
||||||
)
|
)
|
||||||
@@ -128,8 +128,8 @@ func main() {
|
|||||||
pi: &i,
|
pi: &i,
|
||||||
intr: &Struct{},
|
intr: &Struct{},
|
||||||
m: map[string]uint64{"a": 31, "b": 32},
|
m: map[string]uint64{"a": 31, "b": 32},
|
||||||
// c: make(chan int),
|
c: make(chan int),
|
||||||
err: errors.New("Test error"),
|
err: errors.New("Test error"),
|
||||||
// fn: func(s string) (int, error) {
|
// fn: func(s string) (int, error) {
|
||||||
// println("fn:", s)
|
// println("fn:", s)
|
||||||
// return 1, errors.New("fn error")
|
// return 1, errors.New("fn error")
|
||||||
@@ -148,7 +148,7 @@ func main() {
|
|||||||
s.pf, s.pi,
|
s.pf, s.pi,
|
||||||
s.intr,
|
s.intr,
|
||||||
s.m,
|
s.m,
|
||||||
// s.c,
|
s.c,
|
||||||
s.err,
|
s.err,
|
||||||
// s.fn,
|
// s.fn,
|
||||||
)
|
)
|
||||||
|
|||||||
16
ssa/di.go
16
ssa/di.go
@@ -158,7 +158,7 @@ func (b diBuilder) createType(ty Type, pos token.Position) DIType {
|
|||||||
case *types.Array:
|
case *types.Array:
|
||||||
return b.createArrayType(ty, t.Len())
|
return b.createArrayType(ty, t.Len())
|
||||||
case *types.Chan:
|
case *types.Chan:
|
||||||
return b.createBasicType(ty)
|
return b.createChanType(ty)
|
||||||
case *types.Map:
|
case *types.Map:
|
||||||
ty := b.prog.rtType("Map")
|
ty := b.prog.rtType("Map")
|
||||||
tk := b.prog.rawType(t.Key())
|
tk := b.prog.rawType(t.Key())
|
||||||
@@ -365,6 +365,20 @@ func (b diBuilder) createMapType(tyMap, tk, tv Type) DIType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b diBuilder) createChanType(t Type) DIType {
|
||||||
|
tyElem := b.prog.rawType(t.RawType().(*types.Chan).Elem())
|
||||||
|
fmt.Printf("tyElem: %v, %T\n", tyElem, tyElem)
|
||||||
|
return &aDIType{ll: b.di.CreateStructType(
|
||||||
|
llvm.Metadata{},
|
||||||
|
llvm.DIStructType{
|
||||||
|
Name: t.RawType().String(),
|
||||||
|
SizeInBits: b.prog.SizeOf(t) * 8,
|
||||||
|
AlignInBits: uint32(b.prog.sizes.Alignof(t.RawType()) * 8),
|
||||||
|
Elements: []llvm.Metadata{},
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
}
|
||||||
|
|
||||||
func (b diBuilder) createComplexType(t Type) DIType {
|
func (b diBuilder) createComplexType(t Type) DIType {
|
||||||
var tfield Type
|
var tfield Type
|
||||||
if t.RawType().(*types.Basic).Kind() == types.Complex128 {
|
if t.RawType().(*types.Basic).Kind() == types.Complex128 {
|
||||||
|
|||||||
Reference in New Issue
Block a user