]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add coverage fixup mode
authorThan McIntosh <thanm@google.com>
Mon, 7 Mar 2022 15:32:51 +0000 (10:32 -0500)
committerThan McIntosh <thanm@google.com>
Tue, 27 Sep 2022 10:30:53 +0000 (10:30 +0000)
commite6d9057e2f3442b133afe7e37bec72bb9b780b04
tree15ac9b503567f7d7151238f8f9a62235c8d00794
parent072c7d4969862c84430cc2daef20a8f7f3ba78a2
cmd/compile: add coverage fixup mode

Adds a -coveragecfg=<configfile> command line option to the compiler
to help support a cooperative "tool and compiler" mode for coverage
instrumentation. In this mode the cmd/cover tool generates most of the
counter instrumentation via source-to-source rewriting, but the
compiler fixes up the result if passed the "-coveragecfg" option. The
fixups include:

  - reclassifying counter variables (special storage class)
  - marking meta-data variables are read-only
  - adding in an init call to do registation

Updates #51430.

Change-Id: Iead72b85209725ee044542374465f118a3ee72e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/395895
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
12 files changed:
src/cmd/compile/internal/base/flag.go
src/cmd/compile/internal/coverage/cover.go [new file with mode: 0644]
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/ir/symtab.go
src/cmd/compile/internal/pkginit/init.go
src/cmd/compile/internal/typecheck/builtin.go
src/cmd/compile/internal/typecheck/builtin/coverage.go [new file with mode: 0644]
src/cmd/compile/internal/typecheck/builtin/runtime.go
src/cmd/compile/internal/typecheck/mkbuiltin.go
src/cmd/compile/internal/typecheck/syms.go
src/cmd/dist/buildtool.go
src/internal/coverage/cmddefs.go [new file with mode: 0644]