mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-23 11:43:32 +00:00
[llgo] debug: create replaceable type through DIBuilder
Summary: 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. Reviewers: pcc Reviewed By: pcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7852 llvm-svn: 230953
This commit is contained in:
parent
0a6ce9f4e1
commit
ac15169034
@ -340,18 +340,26 @@ func (d *DIBuilder) descriptorStruct(t *types.Struct, name string) llvm.Metadata
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user