mirror of
https://github.com/golang/go
synced 2024-11-17 10:14:46 -07:00
cmd/cgo: add line info for return statements
When calling a C function, line information will be incorrect if the function call's closing parenthesis is not on the same line as the last argument. We add a comment with the line info for the return statement to guide debuggers to the correct line. Fixes #49839.
This commit is contained in:
parent
1ea4d3b911
commit
8b28646d2e
@ -812,6 +812,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
|
||||
|
||||
params := name.FuncType.Params
|
||||
args := call.Call.Args
|
||||
end := call.Call.End()
|
||||
|
||||
// Avoid a crash if the number of arguments doesn't match
|
||||
// the number of parameters.
|
||||
@ -959,7 +960,7 @@ func (p *Package) rewriteCall(f *File, call *Call) (string, bool) {
|
||||
if nu {
|
||||
needsUnsafe = true
|
||||
}
|
||||
sb.WriteString(gofmtLine(m))
|
||||
sb.WriteString(gofmtPos(m, end))
|
||||
|
||||
sb.WriteString("(")
|
||||
for i := range params {
|
||||
|
Loading…
Reference in New Issue
Block a user