]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14] cmd/cgo, misc/cgo: only cache anonymous struct typedefs with...
authorTobias Klauser <tklauser@distanz.ch>
Sun, 29 Mar 2020 22:38:09 +0000 (00:38 +0200)
committerIan Lance Taylor <iant@golang.org>
Mon, 30 Mar 2020 21:07:05 +0000 (21:07 +0000)
commitcdd55a324b2baf8db4891dcd741a26a31f986d8f
tree45ced790678000996999d2cb209d3cadd391ca3f
parente6f15fab0af132b680e0c08ba16abeb191b82623
[release-branch.go1.14] cmd/cgo, misc/cgo: only cache anonymous struct typedefs with parent name

CL 181857 broke the translation of certain C types using cmd/cgo -godefs
because it stores each typedef, array and qualified type with their
parent type name in the translation cache.

Fix this by only considering the parent type for typedefs of anonymous
structs which is the only case where types might become ambiguous.

Fixes #37622

Change-Id: I301a749ec89585789cb0d213593bb8b7341beb88
Reviewed-on: https://go-review.googlesource.com/c/go/+/226341
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit a265c2c448497fcee1633d2e2b912da52ea22d3c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/226497
misc/cgo/testgodefs/testdata/issue37479.go [new file with mode: 0644]
misc/cgo/testgodefs/testdata/issue37621.go [new file with mode: 0644]
misc/cgo/testgodefs/testdata/main.go
misc/cgo/testgodefs/testgodefs_test.go
src/cmd/cgo/gcc.go