cvtCType bugfix

This commit is contained in:
xushiwei
2024-05-03 17:03:12 +08:00
parent 133d41d748
commit 8eeac8a26d
2 changed files with 9 additions and 2 deletions

View File

@@ -1,7 +1,8 @@
; ModuleID = 'main'
source_filename = "main"
%"github.com/goplus/llgo/internal/abi.Type" = type { i64, i64, i32, i8, i8, i8, i8, ptr, ptr, i32, i32 }
%"github.com/goplus/llgo/internal/abi.Type" = type { i64, i64, i32, i8, i8, i8, i8, %"github.com/goplus/llgo/internal/runtime.Closure", ptr, i32, i32 }
%"github.com/goplus/llgo/internal/runtime.Closure" = type { ptr, ptr }
@main.basicTypes = global ptr null
@"main.init$guard" = global ptr null

View File

@@ -16,7 +16,9 @@
package ssa
import "go/types"
import (
"go/types"
)
// -----------------------------------------------------------------------------
@@ -72,6 +74,10 @@ func cvtCType(typ types.Type) (types.Type, bool) {
}
case *types.Struct:
return cvtCStruct(t)
case *types.Named:
if _, cvt := cvtCType(t.Underlying()); cvt {
panic("todo: named type")
}
case *types.Signature:
t = CFuncDecl(t)
return (*CFuncPtr)(t), true