aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevon H. O'Dell <devon.odell@gmail.com>2009-12-23 09:26:21 -0800
committerRuss Cox <rsc@golang.org>2009-12-23 09:26:21 -0800
commit7c9111434a6ef6ee8fb01fcdda28bd4f935ddbd3 (patch)
treef4f1839c7a62a13f826b65ce2417cd5c5ed55013
parent3f25c8a2ef3f9e9c55132ff770ae54efd289a21d (diff)
downloadgo-7c9111434a6ef6ee8fb01fcdda28bd4f935ddbd3.tar.gz
go-7c9111434a6ef6ee8fb01fcdda28bd4f935ddbd3.zip
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
-rw-r--r--src/cmd/cgo/ast.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/cgo/ast.go b/src/cmd/cgo/ast.go
index 76ff9ec653..c78d8bb8e6 100644
--- a/src/cmd/cgo/ast.go
+++ b/src/cmd/cgo/ast.go
@@ -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")
}