mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: don't cache bad pointer typedefs
The set of bad pointer typedefs changes as we see more typedefs, so avoid looking in the cache when we find one. Fixes #29175 Change-Id: Idd82289bdd8628d11a983fa5ec96517e3a5bcbf1 Reviewed-on: https://go-review.googlesource.com/c/153597 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f6a163177f
commit
01e072db5d
1 changed files with 14 additions and 4 deletions
|
|
@ -2177,12 +2177,22 @@ func (c *typeConv) FinishType(pos token.Pos) {
|
||||||
// Type returns a *Type with the same memory layout as
|
// Type returns a *Type with the same memory layout as
|
||||||
// dtype when used as the type of a variable or a struct field.
|
// dtype when used as the type of a variable or a struct field.
|
||||||
func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
|
func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type {
|
||||||
|
// Always recompute bad pointer typedefs, as the set of such
|
||||||
|
// typedefs changes as we see more types.
|
||||||
|
checkCache := true
|
||||||
|
if dtt, ok := dtype.(*dwarf.TypedefType); ok && c.badPointerTypedef(dtt) {
|
||||||
|
checkCache = false
|
||||||
|
}
|
||||||
|
|
||||||
key := dtype.String()
|
key := dtype.String()
|
||||||
if t, ok := c.m[key]; ok {
|
|
||||||
if t.Go == nil {
|
if checkCache {
|
||||||
fatalf("%s: type conversion loop at %s", lineno(pos), dtype)
|
if t, ok := c.m[key]; ok {
|
||||||
|
if t.Go == nil {
|
||||||
|
fatalf("%s: type conversion loop at %s", lineno(pos), dtype)
|
||||||
|
}
|
||||||
|
return t
|
||||||
}
|
}
|
||||||
return t
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t := new(Type)
|
t := new(Type)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue