fix types named recursive

This commit is contained in:
visualfc
2024-05-11 12:03:02 +08:00
parent 2589c23998
commit 92827a1f04
5 changed files with 201 additions and 6 deletions

View File

@@ -255,7 +255,11 @@ func (p Program) toType(raw types.Type) Type {
}
func (p Program) toLLVMNamedStruct(name string, raw *types.Struct) llvm.Type {
if typ, ok := p.named[name]; ok {
return typ
}
t := p.ctx.StructCreateNamed(name)
p.named[name] = t
fields := p.toLLVMFields(raw)
t.StructSetBody(fields, false)
return t