Skip to content

Commit

Permalink
ir/metadata: use *DICompileUnit for unit field
Browse files Browse the repository at this point in the history
  • Loading branch information
mewmew committed Jan 2, 2019
1 parent 6712721 commit bdf0626
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion asm/specialized_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,14 @@ func (gen *generator) irDISubprogram(new metadata.SpecializedNode, old *ast.DISu
if err != nil {
return nil, errors.WithStack(err)
}
md.Unit = unit
switch unit := unit.(type) {
case *metadata.NullLit:
// nothing to do.
case *metadata.DICompileUnit:
md.Unit = unit
default:
panic(fmt.Errorf("support for metadata DISubprogram unit field type %T not yet implemented", unit))
}
case *ast.TemplateParamsField:
templateParams, err := gen.irMDField(oldField.TemplateParams())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion ir/metadata/specialized_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ type DISubprogram struct {
ThisAdjustment int64 // optional; zero value if not present.
Flags enum.DIFlag // optional.
IsOptimized bool // optional; zero value if not present.
Unit Field // optional; nil if not present.
Unit *DICompileUnit // optional; nil if not present.
TemplateParams *Tuple // optional; nil if not present.
Declaration Field // optional; nil if not present.
RetainedNodes *Tuple // optional; nil if not present.
Expand Down

0 comments on commit bdf0626

Please sign in to comment.