ssa: complex type name
This commit is contained in:
@@ -100,7 +100,29 @@ func FuncWithAllTypeParams(
|
|||||||
err,
|
err,
|
||||||
fn,
|
fn,
|
||||||
)
|
)
|
||||||
return 1, errors.New("Some error")
|
// Expected:
|
||||||
|
// all variables: i8 i16 i32 i64 i u8 u16 u32 u64 u f32 f64 b c64 c128 slice arr arr2 s e f pf pi intr m c err fn globalInt globalStruct globalStructPtr
|
||||||
|
// i8: '\x01'
|
||||||
|
// i16: 2
|
||||||
|
// i32: 3
|
||||||
|
// i64: 4
|
||||||
|
// i: 5
|
||||||
|
// u8: '\x06'
|
||||||
|
// u16: 7
|
||||||
|
// u32: 8
|
||||||
|
// u64: 9
|
||||||
|
// u: 10
|
||||||
|
// f32: 11
|
||||||
|
// f64: 12
|
||||||
|
// b: true
|
||||||
|
// c64: complex64(real = 13, imag = 14)
|
||||||
|
// c128: complex128(real = 15, imag = 16)
|
||||||
|
// slice: []int[21, 22, 23]
|
||||||
|
// arr: [3]int[24, 25, 26)
|
||||||
|
// arr2: [3]E[(i = 27), (i = 28), (i = 29)]
|
||||||
|
// s: hello
|
||||||
|
// e: (i = 30)
|
||||||
|
return 1, errors.New("some error")
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -164,7 +186,12 @@ func main() {
|
|||||||
println("called function with types")
|
println("called function with types")
|
||||||
println(globalStructPtr)
|
println(globalStructPtr)
|
||||||
println(&globalStruct)
|
println(&globalStruct)
|
||||||
|
// Expected:
|
||||||
|
// all variables: globalInt globalStruct globalStructPtr s i err
|
||||||
|
// s.i8: '\x01'
|
||||||
|
// s.i16: 2
|
||||||
println("done")
|
println("done")
|
||||||
|
println("")
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalInt int = 301
|
var globalInt int = 301
|
||||||
|
|||||||
@@ -334,12 +334,15 @@ func (b diBuilder) createChanType(name string, t Type, pos token.Position) DITyp
|
|||||||
|
|
||||||
func (b diBuilder) createComplexType(t Type) DIType {
|
func (b diBuilder) createComplexType(t Type) DIType {
|
||||||
var tfield Type
|
var tfield Type
|
||||||
|
var tyName string
|
||||||
if t.RawType().(*types.Basic).Kind() == types.Complex128 {
|
if t.RawType().(*types.Basic).Kind() == types.Complex128 {
|
||||||
tfield = b.prog.Float64()
|
tfield = b.prog.Float64()
|
||||||
|
tyName = "complex128"
|
||||||
} else {
|
} else {
|
||||||
tfield = b.prog.Float32()
|
tfield = b.prog.Float32()
|
||||||
|
tyName = "complex64"
|
||||||
}
|
}
|
||||||
return b.doCreateStructType("complex", t, token.Position{}, func(ditStruct DIType) []llvm.Metadata {
|
return b.doCreateStructType(tyName, t, token.Position{}, func(ditStruct DIType) []llvm.Metadata {
|
||||||
return []llvm.Metadata{
|
return []llvm.Metadata{
|
||||||
b.createMemberType("real", t, tfield, 0),
|
b.createMemberType("real", t, tfield, 0),
|
||||||
b.createMemberType("imag", t, tfield, 1),
|
b.createMemberType("imag", t, tfield, 1),
|
||||||
|
|||||||
Reference in New Issue
Block a user