# implement code coverage instrumentation manually · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/b8d99a332395ec0a1b9ed1a8e18f0db8db131b3c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: b8d99a332395ec0a1b9ed1a8e18f0db8db131b3c

Requested commit: b8d99a332395ec0a1b9ed1a8e18f0db8db131b3c

Commit: b8d99a332395ec0a1b9ed1a8e18f0db8db131b3c

Tree: 556064f0106c74ccd25f8be96aad973cef320e26

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
implement code coverage instrumentation manually

instead of relying on the LLVM sancov pass. The LLVM pass is still
executed if trace_pc_guard is requested, disabled otherwise. The LLVM
backend emits the instrumentation directly.

It uses `__sancov_pcs1` symbol name instead of `__sancov_pcs` because
each element is 1 usize instead of 2.

AIR: add CoveragePoint to branch hints which indicates whether those
branches are interesting for code coverage purposes.

Update libfuzzer to use the new instrumentation. It's simplified since
we no longer need the constructor and the pcs are now in a continguous
list.

This is a regression in the fuzzing functionality because the
instrumentation for comparisons is no longer emitted, resulting in worse
fuzzer inputs generated. A future commit will add that instrumentation
back.

```

## Parents

- [43dc8db068f65f31cd7cf808429c627b29058582](https://git.cafe/gitcafe/zig/commit/43dc8db068f65f31cd7cf808429c627b29058582?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/b8d99a332395ec0a1b9ed1a8e18f0db8db131b3c?format=markdown)
