mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: run recordTypes for each of the debugs at the end of Translate
Save the debug information in a slice and then process all of them at the end of the loop. For #75167 Change-Id: I6a6a6964dffa784b0aa776334562333ecf247023 Reviewed-on: https://go-review.googlesource.com/c/go/+/699019 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Michael Matloob <matloob@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
5e6296f3f8
commit
cf42b785b7
1 changed files with 8 additions and 5 deletions
|
|
@ -192,9 +192,7 @@ func (p *Package) Translate(f *File) {
|
|||
cref.Name.C = cname(cref.Name.Go)
|
||||
}
|
||||
|
||||
var conv typeConv
|
||||
conv.Init(p.PtrSize, p.IntSize)
|
||||
|
||||
var debugs []*debug // debug data from iterations of gccDebug
|
||||
ft := fileTypedefs{typedefs: make(map[string]bool)}
|
||||
numTypedefs := -1
|
||||
for len(ft.typedefs) > numTypedefs {
|
||||
|
|
@ -213,8 +211,7 @@ func (p *Package) Translate(f *File) {
|
|||
}
|
||||
needType := p.guessKinds(f)
|
||||
if len(needType) > 0 {
|
||||
d := p.loadDWARF(f, &ft, needType)
|
||||
p.recordTypes(f, d, &conv)
|
||||
debugs = append(debugs, p.loadDWARF(f, &ft, needType))
|
||||
}
|
||||
|
||||
// In godefs mode we're OK with the typedefs, which
|
||||
|
|
@ -224,6 +221,12 @@ func (p *Package) Translate(f *File) {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
var conv typeConv
|
||||
conv.Init(p.PtrSize, p.IntSize)
|
||||
for _, d := range debugs {
|
||||
p.recordTypes(f, d, &conv)
|
||||
}
|
||||
p.prepareNames(f)
|
||||
if p.rewriteCalls(f) {
|
||||
// Add `import _cgo_unsafe "unsafe"` after the package statement.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue