cgo: don't overwrite p.Crefs

It's expected to be shared between all files so that all types are output.
Fixes bug reported on mailing list by Peter Froehlich.

R=rsc, phf
CC=golang-dev
https://golang.org/cl/183043
This commit is contained in:
Devon H. O'Dell 2009-12-23 09:26:21 -08:00 committed by Russ Cox
parent 3f25c8a2ef
commit 7c9111434a

View File

@ -118,7 +118,9 @@ func openProg(name string, p *Prog) {
}
// Accumulate pointers to uses of C.x.
p.Crefs = make([]*Cref, 0, 8)
if p.Crefs == nil {
p.Crefs = make([]*Cref, 0, 8)
}
walk(p.AST, p, "prog")
}