Skip to content

Commit

Permalink
go-fuzz-build: add yet more positions
Browse files Browse the repository at this point in the history
This fixes yet more manifestations of #294.
  • Loading branch information
josharian committed Feb 2, 2024
1 parent 7955ebc commit 2bb6d9c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions go-fuzz-build/cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,19 +850,23 @@ func (f *File) newCounter(start, end token.Pos, numStmt int) ast.Stmt {
}

idx := &ast.BasicLit{
Kind: token.INT,
Value: strconv.Itoa(cnt),
Kind: token.INT,
Value: strconv.Itoa(cnt),
ValuePos: start,
}
counter := &ast.IndexExpr{
X: &ast.SelectorExpr{
X: ast.NewIdent(fuzzdepPkg),
Sel: ast.NewIdent("CoverTab"),
},
Index: idx,
Index: idx,
Lbrack: start,
Rbrack: end,
}
return &ast.IncDecStmt{
X: counter,
Tok: token.INC,
X: counter,
Tok: token.INC,
TokPos: start,
}
}

Expand Down

0 comments on commit 2bb6d9c

Please sign in to comment.