[PATCH] [llgo] debug: create replaceable type through DIBuilder
Andrew Wilkins
axwalk at gmail.com
Tue Feb 24 02:28:56 PST 2015
Hi pcc,
llgo was asserting in DebugInfo, which was interpreting
the temporary MDNodes we were creating as DIScopes instead
of DITypes (in DIScope::getRef).
This proposal changes llgo to use DIBuilder's
createReplaceableCompositeType method to create a DIType
that can be RAUW'd.
http://reviews.llvm.org/D7852
Files:
debug/debug.go
Index: debug/debug.go
===================================================================
--- debug/debug.go
+++ debug/debug.go
@@ -340,18 +340,26 @@
}
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,
})
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7852.20583.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150224/c82485d9/attachment.bin>
More information about the llvm-commits
mailing list