}
func (d *DIBuilder) descriptorNamed(t *types.Named) llvm.Metadata {
- // Create a placeholder for the named type, to terminate cycles.
- placeholder := llvm.GlobalContext().TemporaryMDNode(nil)
- d.types.Set(t, placeholder)
var diFile llvm.Metadata
var line int
if file := d.fset.File(t.Obj().Pos()); file != nil {
line = file.Line(t.Obj().Pos())
diFile = d.getFile(file)
}
+
+ // Create a placeholder for the named type, to terminate cycles.
+ name := t.Obj().Name()
+ placeholder := d.builder.CreateReplaceableCompositeType(d.scope(), llvm.DIReplaceableCompositeType{
+ Tag: dwarf.TagStructType,
+ Name: name,
+ File: diFile,
+ Line: line,
+ })
+ d.types.Set(t, placeholder)
+
typedef := d.builder.CreateTypedef(llvm.DITypedef{
Type: d.DIType(t.Underlying()),
- Name: t.Obj().Name(),
+ Name: name,
File: diFile,
Line: line,
})