]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: fix line number annotations in generated C code
authorRuss Cox <rsc@golang.org>
Fri, 1 Feb 2013 16:34:08 +0000 (08:34 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 1 Feb 2013 16:34:08 +0000 (08:34 -0800)
commitf20e3a10654e71823d58fb5d2deefce24d44a76f
tree98761760a8eee45a9cd9dd1cf69f87f708fc040d
parented9fc7531d80d0894d52c96a4a79968842df945b
cmd/cgo: fix line number annotations in generated C code

The old version was using go/ast's CommentGroup.Text method,
but that method drops leading blank lines from the result, so that
if the comment looked like one of

//
// syntax error
import "C"

/*
syntax error
*/
import "C"

then the line numbers for the syntax error would be off by the
number of leading blank lines (1 in each of the above cases).

The new text extractor preserves blank lines.

Fixes #4019.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7232071
src/cmd/cgo/ast.go